问题描述
我正在使用此目录结构:
I am using this directory structure :
Parent
|
|--Back-end(one module FOR enitity)
| |- pom.xml
|
|--Back-end(one module FOR rest)
| |- pom.xml
|
|--Back-end(one module FOR service)
| |- pom.xml
|
|--Front-end(module for angular)
| |-public
| | |-myApp
| | |-all angularjs related files
|
|
|
|pom.xml
我的后端模块产生了WAR,但现在如何对angular进行单独的战争:这里的目标是能够将整个javascript应用程序(angularjs)部署为java war文件.
My back-end module produces a WAR but now how to make separate war for angular : the goal here is to be able to deploy the entire javascript application(angularjs) as a java war file.
推荐答案
尝试对所有模块使用<packaging>jar</packaging>
.然后创建两个具有<packaging>war</packaging>
且依赖于其他模块创建的普通JAR的新模块.
Try to use <packaging>jar</packaging>
for all modules. Then create two new modules which have <packaging>war</packaging>
and which depend on the plain JARs created by the other modules.
这样,您可以在WAR中重用Java代码.如果要共享WEB-INF
下的文件,则可以为此创建一个通用的WAR模块,并使用战争叠加层.这意味着您有许多生成JAR的模块和三个生成WAR的模块.请注意,WAR叠加层较脆,因此最好远离它们.
That way, you can reuse the Java code in your WARs. If you want to share files below WEB-INF
, then you can create a common WAR module for that and use WAR overlays. This means you have many modules which produce JARs and three that produce WARs. Note that WAR overlays are somewhat brittle, so it's often better to stay away from them.
这篇关于如何在多模块Maven项目中为我的前端(angularjs)创建单独的战争的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!