I have a Maven project, with 4 components Web, Persistence, Common and Other.
The relevant stuff off my POM files:
Parent POM:
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<modules>
<module>components/TestWeb</module>
<module>components/TestOther</module>
<module>components/TestPersistence</module>
<module>components/TestCommon</module>
</modules>
<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<dependentWarExcludes>
**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**
</dependentWarExcludes>
</configuration>
</plugin>
</plugins>
</build>
common pom:
<modelVersion>4.0.0</modelVersion>
<artifactId>test-common</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>0.0.1-SNAPSHOT</version>
</parent>
persistence pom:
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test-persistence</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>test-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
web pom:
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test-web</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>TestWeb</name>
<parent>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependency>
<groupId>com.test</groupId>
<artifactId>test-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>test-persistence</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.test</groupId>
<artifactId>test-other</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Maybe I broke something in the copy&paste, but the XML is valid.
- when I run mvn package, the project WAR file isn't created, but all components packages are created and well formed.
- if, then, I run
mvn war:war
, the WAR file is generated empty.
How can fix this?