我在http://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html之后使用以下父pom.xml
创建了一个多模块Maven原型:
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
<packaging>pom</packaging>
<name>${rootArtifactId}</name>
<modules>
<module>${rootArtifactId}-jar</module>
<module>${rootArtifactId}-ejb</module>
<module>${rootArtifactId}-web</module>
<module>${rootArtifactId}-ear</module>
</modules>
</project>
src/main/resources/archetype-resources/pom.xml
中的。我希望在pom.xml
之后生成的mvn archetype:generate
包含modules
元素,并且替换了rootArtifactId
的子项,但生成的pom.xml
是
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>myGroup</groupId>
<artifactId>myArtifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>myArtifact</name>
</project>
可以在https://github.com/krichter722/javaee-example-archetype找到原型。