Reputation: 21981
I'm trying to grab my project and generate an Archetype from it via :
archetype:create-from-project
The thing is, that my project has src/main/java package structure com.sample.app, but the archetype must have it as user wants when generating the project from archetype, but that is impossible I suppose. It doesn't seem to grab groupId and artifactId and generate archetype-resources/src/main/java
based on this input.
Anyway, that's why there is this argument I suppose : packageName
mvn archetype:create-from-project -DpackageName=com.sample.app
But it doesn't work and there is still archetype-resources/src/main/java/org/sample/app
..
Upvotes: 3
Views: 5195
Reputation: 14232
The create-from-project
goal usually automatically detects the base package name and replaced it, so you would end up with having
\templateproject\target\generated-sources\archetype\src\main\resources\archetype-resources\src\test\java\Foo.java
with a package declaration of ${package}
Try the archetype plugin and create-from-project with a nearly empty hello-world project and you will see that the generated archetype has the package removed. That way, the user who uses archetype:generate
can specify his package name at generation time.
Upvotes: 4