Maven Archetype Catalog
Having some trouble getting a remote archetype catalog created. I figure it could be automatically managed by maven when I push an archetype but there doesnt seem to be good documentation around it.
I'm using AWS CodeArtifact as my remote repo, which means I need to have all files inside a package, where the docs outline the
archetype-catalog.xml
should be at the root of the repo
Anyone have any experience with this?29 Replies
⌛
This post has been reserved for your question.
Hey @Fionn! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
What happens when using it?
I'm not sure at all how to use it - I keep getting it resolving to the "root" of my regular remote repo but not to that
archetype
repository I've defined in settings.xml
it's quite under-documented and not a lot of examples/walkthroughs onlineWhat command are you using and what happens?
the plugin always looks for
archetype-catalog.xml
in the root of the repo you tell it about -- but uploads to my repo are versioned, e.g. archetype-catalog-1.0.0.xml
inside a packae I created to host it
yes that would be good info to include, one sec..so the issue is the version being there?
not even sure tbh, I'm having more trouble pointing the archetype plugin to the place I tell it
accordingg to the docs here: https://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html#archetypeCatalog
I should specify a repository in my settings.xml with id of "archetype"
but when I run
mvn archetype:generate (groupID/artifactId)
then I get "Could not find metadata /archetype-catalog.xml in central" (where Central is my "main" private repo)That's forthere's also https://maven.apache.org/archetype/maven-archetype-plugin/archetype-repository.html
but yeah it's just a Maven repo
I think you could also use other IDs if wanted
Even once it's hosted, I dont understand how it would be maintained -- the local catalog (~/.m2/repository/archetype-catalog.xml) is update when you install an archetype locally, but in a remote setting, I dont see that getting updated
you just update the file on the server
right, so as part of CI/CD you would copy down that file, install the archetype and push it again -- seems wieldy
you need some file that lists what's available
if you are using a repository manager like nexus, that should support different things
hmm I'm using CodeArtifact, let me see do they have an equivelant
but essentially you have the XML file listing the stuff
it's also possible to create the catalog from crawling a Maven repo
yepp I was able to do that locally, but not sure how I would set that up on the remote
that's probably the easiest if your repo tool doesn't support it
still doesnt solve how to get the plugin to target the archetype
thankfully its only a single archetype I want to share right now
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
so It's looking like it may be a case of asking team members to install the archetype locally with a git clone + mvn install
?
it must be that CodeArtifact is not compatible with this -- the archetype plugin expects the catalog.xml at the root, but CodeArtifact needs to put it inside a folder
if everything is in a folder, you can set the maven repo to that folder
wont it try to resolve all packages recursively from the root of that repo ?
It wont go "up" out the folder and see all the actual archetypes
yes, the packages would need to be relative to the repo root
exactly - you cant do that in CodeArtifact
gonna give up and leave it there -- my team can local install the archetype when needed 😅
Can you try
-DarchetypeCatalog=
maybe?yepp tried that
thanks for walking through anyway, I'll take the defeat here 😄
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@269241887213223936>.