I have two questions about creating a Maven archetype:

1. How do I get my Maven archetype project to show up in the interactive
list of archetypes that appear when running "mvn archetype:generate"? I've
installed my project into my local repository, but when I run that command,
I only see the standard 366 archetypes show up. I am able to generate the
archetype by specifying the archetype identifiers via project properties
(e.g., -DarchetypeArtifactId=my-archetype -DarchetypeGroupId=com.company.my ),
but I was curious how I would get it listed in the main listing. It's not
important that I do so, I'm really just curious at this point what one has
to do.


2. When I generate an instance of my archetype, why does a folder named
after the group I specify as the generated project's groupId appear in
generated project between src/main/webapp/ and the webapp files themselves?
Two pictures are worth two thousand words:


my-archetype/

├── pom.xml

└── src

    └── main

        └── resources

            ├── META-INF

            │   └── maven

            │       └── archetype-metadata.xml

            └── archetype-resources

                ├── pom.xml

                └── src

                    ├── main

                    │   ├── java

                    │   │   ├── App.java

                    │   └── webapp

                    │       ├── WEB-INF

                    │       │   └── web.xml

                    │       └── index.jsp

                    └── test

                        └── java

                            └── AppTest.java



testArtifact/

├── pom.xml

└── src

    ├── main

    │   ├── java

    │   │   └── testGroup

    │   │       ├── App.java

    │   └── webapp

    │       └── testGroup *<--- why is this here?*

    │           ├── WEB-INF

    │           │   └── web.xml

    │           └── index.jsp

    └── test

        └── java

            └── testGroup

                └── AppTest.java


I can see why it might add this for the "main/java" and "test/java"
directories, because Maven might be trying to helpfully insert a Java
package name based on the supplied groupId, but it doesn't make sense (to
me) that it does so for the "webapp" directory. And in my particular case, I
don't even want it for the "java" directories. Is there some way to suppress
this?


e

Reply via email to