Sean Champ
Sean Champ

Reputation: 301

How to apply a Maven archetype to an existing project?

I've created a Maven archetype that installs some documentation stubs into a new project. In configuring the archetype, I've set 'allowPartial' to 'true' in the archetype's archetype.xml file.

I would like to apply that archetype to an existing project - it's my understanding that the 'true' value for 'allowPartial' should enable that feature.

If the artifact is named foo:bar:1.0-RELEASE, then What Maven command should I run, to apply the archetype foo:bar:1.0-RELEASE to an existing project?

I've managed to use the archetype to create a module B within an existing project A, or to create a new project A.

I would like to use the archetype to modify A - adding content to the project, without modifying its POM or other resources not affected with the archetype. I just don't know what Maven command I should use, which would make that occur as intended.

Upvotes: 1

Views: 2820

Answers (1)

Troels
Troels

Reputation: 46

There's a new version of the archetype-metadata.xml file where you specify the partial-flag as an attribute in the archetype-descriptor element:

<archetype-descriptor 
    xmlns="..." 
    xsi:schemaLocation="..." 
    name="MyProject" 
    partial="true">
...
</archetype-descriptor>

Upvotes: 3

Related Questions