Use __groupId__ in archetype

2019-08-24 17:25发布

I'm trying to create a multi module archetype like the following:

__groupId__.plugin
__groupId__.feature

I want to set the names of the modules by groupId. So I use __groupId__ In order to set the module names. The problem is that these template doesn't get recognized. When I use __rootArtifactId__ my code works. Am I using the wrong template name?

I have the following structure:

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

The module description in archetype-metadata.xml looks like this:

<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>

1条回答
爷的心禁止访问
2楼-- · 2019-08-24 18:06

You can think of using the "packaged" property of the fileSet. By using it you can alter the "package" property default value and adding the files directly in the customized folder.

查看更多
登录 后发表回答