我有一个archetype-project看起来像这样(有两个模块,__artifactId__-1
和__artifactId__-2
):
Parent
pom.xml
__artifactId__-1
pom.xml
__artifactId__-2
pom.xml
并且,当我使用这个带有工件ID的原型生成一个项目时,说'Infra',它应该产生这样的结构:
Parent
pom.xml
Infra-1
pom.xml
Infra-2
pom.xml
它确实如此。所以这确实有效。
什么行不通的是在父pom.xml中,我把这些模块包含在:
<modules>
<module>__artifactId__-1</module>
<module>__artifactId__-2</module>
</modules>
这些模块条目不会重命名为(生成时):
<modules>
<module>Infra-1</module>
<module>Infra-2</module>
</modules>
这就是我想要的。
任何想法如何做到这一点,谢谢。
的更新 的 我在这里按要求添加元数据xml文件,但我不想修改archetype-metadata.xml文件。 因为我想使用create-from-project命令创建原型,然后安装和生成而无需任何手动干预或返工。
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="archetype-1"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>__artifactId__-1/src</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>support</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.txt</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>properties/deploy</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>__artifactId__-2/target</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>__artifactId__-2/src</directory>
<includes>
<include>**/*.jsp</include>
<include>**/*.java</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>properties</directory>
<includes>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>__artifactId__-2</directory>
<includes>
<include>**/*.project</include>
<include>**/*.xml</include>
<include>**/*.classpath</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>__artifactId__-1</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>support/lib</directory>
<includes>
<include>**/*.txt</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>__artifactId__-2/.settings</directory>
<includes>
<include>**/*.prefs</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>support</directory>
<includes>
<include>**/*.jar</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>__artifactId__-2/src</directory>
<includes>
<include>**/*.jpg</include>
<include>**/*.MF</include>
<include>**/*.md</include>
<include>**/*.png</include>
<include>**/*.jar</include>
<include>**/*.js</include>
<include>**/*.ftl</include>
<include>**/*.xsd</include>
<include>**/*.XML</include>
<include>**/*.TXT</include>
<include>**/*.gif</include>
<include>**/*.css</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>__artifactId__-2</directory>
<includes>
<include>**/*.checkstyle</include>
<include>**/*.pmd</include>
<include>**/*.log</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>support/bin</directory>
<includes>
<include>**/*.bat</include>
<include>**/*.log</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>support/lib</directory>
<includes>
<include>**/*.jar</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
答案 0 :(得分:0)
现在修复。
在父pom.xml中,模块声明位于配置文件中。