1

我有一个原型项目,看起来像这样(有两个模块,__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>
4

1 回答 1

0

现在修好了。

在父 pom.xml 中,模块声明在配置文件中。

于 2013-04-02T10:58:43.467 回答