Reputation: 2731
I have created an archetype and added it to maven central (https://repo.maven.apache.org/maven2/nl/ivonet/javaee8-essentials-archetype/)
Now to test if I can get it from the central repo I removed my local versions from ~/.m2/repository
and also removed the references form ~/.m2/repository/archetype-catalog.xml
I tried mvn archetype:generate -Dfilter=nl.ivonet:javaee8-essentials-archetype -U
to generate a new project but I don't get my archetype in the filtered list.
How do I get the apache central hosted archetype in my local catalog? without having to build it myself that is
The goal is to get it offline available again...
Upvotes: 4
Views: 777
Reputation: 3040
Option 1
You can get the dependencies with the maven dependency plugin as follows
mvn dependency:get -DgroupId=nl.ivonet \
-DartifactId=javaee8-essentials-archetype -Dversion=0.0.2
And then next time when you are offline or you want to work with your cache, you call the generate with -o
flag (offline)
mvn archetype:generate (...) -o
Option 2
Use mvn archetype:crawl
which searches your local repository for available archetypes and creates a catalog file under ~/.m2/repository/archetype-catalog.xml
.
Then you can use the catalog file when generating archetype:
mvn archetype:generate -DarchetypeCatalog=file://path/to/catalog (...)
Upvotes: 2
Reputation: 553
You need to run mvn archetype:generate -DarchetypeArtifactId=javaee8-essentials-archetype -DarchetypeVersion=0.0.2 -U
You haven't provided the version, that's why your command didn't worked.
Upvotes: 0