I would like to have a final war package that contains two packages of war:
Frontend - angularjs, BackendApi - including REST to the next (outside api)
I realize that I can pack it in ear, but I care about the war
<modules>
<module>Commons</module> <!-- jar package -->
<module>WarCreator</module> <!-- war package -->
<module>Web/Frontend</module> <!-- war package -->
<module>Web/BackendApi</module> <!-- war package -->
</modules>
WarCreator builds the entire package in war, pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>testtest</artifactId>
<groupId>testtest</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<artifactId>Dist</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>testtest</groupId>
<artifactId>Frontend</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
<dependency>
<groupId>testtest</groupId>
<artifactId>BackendApi</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
</dependencies>
</project>
Both Backend and FrontendApi packages have jboss-web.xml files, with the following settings:
<jboss-web>
<context-root>/rest</context-root>
</jboss-web>
<jboss-web>
<context-root>/view</context-root>
</jboss-web>
but the final war pack has only the first module and only this one is registered (visible in the widlfly logs).
Is there a way to get a war containing two packages of war?
Where did you see that you could package two wars in a war ?
A war is not designed to contain another war.
Maven will not allow to do it naturally as you noticed. And even if you manage to do that by using a trick, the application server will probably not recognize them.
To achieve what you want, use rather a EAR that is the conventional way to package multiple wars or better : don't try to correlate them.
Indeed, make the WARs independent provides much more flexibility for their deployment and maintenance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.