I'm trying to create an archetype to generate a Maven project with some properties that will be used in the files and with the file names and directory structure.
The problem I am running into is how to control the package directory structure? No matter what I have tried so far, the groupId I specify (which is a mandatory parameter in archetype:generate) forces itself as the package directory structure. If I try and have something different in my archetype-resources directory setup, or in the package name in the Java files themselves, I end up with whatever I specified there, AS WELL AS the groupId.
Effectively, I want my project structure to be different to my groupId, but the archetype generate seems to be forcing the groupId onto the package structure.
Is there a way to stop this?
If I use the following command:
archetype:generate -DarchetypeGroupId=archetype.test -DarchetypeArtifactId=archetype-test -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=com.example.test.project-DartifactId=my.test.project.artifact -Dversion=1.0.0-SNAPSHOT
With the following fileset:
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/MyClass.java</include>
</includes>
</fileSet>
I end up with my Java files being under:
src/main/java/com/example/test/project/MyClass.java.
I still want the same groupId, but I want my class to be in a separate directory, such as:
src/main/java/com/different/project/MyClass.java