質問

I am currently updating a maven archetype for our project, and would like to reduce the quantity of information that users will have to give when using this archetype. The groupId will always be the same, for instance.

So, is it possible to define a default value for groupId in a Maven archetype ?

役に立ちましたか?

解決

If you are working in a fixed organisation where this value will not change on a per project basis: Use a parent POM. Distribute it through your repository (you use some kind of central repository, even if it is only a network drive, do you?).

Inclusion in project

<artifactId>greattool</artifactId>
<packaging>war</packaging>
<parent>
    <groupId>com.example</groupId>
    <artifactId>master-parent-pom</artifactId>
    <version>0.0.1</version>
</parent>

Parent POM

<groupId>com.example</groupId>
<artifactId>master-parent-pom</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<description>Parent POM for our projects, specific project type POMs derive from this.</description>

So no group id in the project POM, the one from the parent POM will be used. Of course you are replacing the group id with the inclusion of the parent POM but that is helpful as you can further customize Maven to your organisation's specific needs there.

If you use a build and test server you can even set the parent's version to -SNAPSHOT to automatically distribute changes in the parent POM to the project POMs.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top