【问题标题】:Use __groupId__ in archetype在原型中使用 __groupId__
【发布时间】:2014-06-03 17:42:46
【问题描述】:

我正在尝试创建一个多模块原型,如下所示:

__groupId__.plugin
__groupId__.feature

我想通过 groupId 设置模块的名称。所以我使用__groupId__ 来设置模块名称。问题是这些模板没有被识别。当我使用 __rootArtifactId__ 我的代码有效。我是否使用了错误的模板名称?

我有以下结构:

archetype
 |--src
    |--main
        |--resources
            |--sonatype-resources
            |   |--__groupId__.plugin
            |   |--__groupId__.feature
            |   |--pom.xml
            |---META-INF
                |---maven
                    |---archetype-metadata.xml

archetype-metadata.xml 中的模块描述如下:

<module id="${groupId}.plugin" dir="__groupId__.parent" name="${groupId}.plugin">
  <fileSets>
    <fileSet filtered="true" encoding="UTF-8">
      <directory></directory>
      <includes>
        <include>.project</include>
        <include>build.properties</include>
      </includes>
    </fileSet>
  </fileSets>
</module>
<module id="${groupId}.parent" dir="__groupId__.feature" name="${groupId}.feature">
  <fileSets>
    <fileSet filtered="true" encoding="UTF-8">
      <directory></directory>
      <includes>
        <include>.project</include>
        <include>build.properties</include>
      </includes>
    </fileSet>
  </fileSets>
</module>

【问题讨论】:

  • &lt;module id="${groupId}.parent" dir="__groupId__.feature" 没有意义,在给定的上下文中它要么是 ${groupId} 要么是 __groupId__,而不是两者都......

标签: maven maven-archetype


【解决方案1】:

您可以考虑使用文件集的“打包”属性。通过使用它,您可以更改“package”属性默认值并直接将文件添加到自定义文件夹中。

【讨论】:

    猜你喜欢
    • 2011-03-06
    • 1970-01-01
    • 2018-02-01
    • 2016-01-25
    • 1970-01-01
    • 2011-07-07
    • 1970-01-01
    • 2013-01-28
    • 1970-01-01
    相关资源
    最近更新 更多