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.xmlshould be at the root of the repo Anyone have any experience with this?
29 Replies
JavaBot
JavaBotthis hour
This post has been reserved for your question.
Hey @Fionn! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st23h ago
What happens when using it?
Fionn
FionnOP23h ago
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 archetyperepository I've defined in settings.xml it's quite under-documented and not a lot of examples/walkthroughs online
dan1st
dan1st23h ago
What command are you using and what happens?
Fionn
FionnOP23h ago
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..
dan1st
dan1st23h ago
so the issue is the version being there?
Fionn
FionnOP23h ago
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)
dan1st
dan1st23h ago
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
Fionn
FionnOP23h ago
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
dan1st
dan1st23h ago
you just update the file on the server
Fionn
FionnOP23h ago
right, so as part of CI/CD you would copy down that file, install the archetype and push it again -- seems wieldy
dan1st
dan1st23h ago
you need some file that lists what's available if you are using a repository manager like nexus, that should support different things
Fionn
FionnOP23h ago
hmm I'm using CodeArtifact, let me see do they have an equivelant
dan1st
dan1st23h ago
but essentially you have the XML file listing the stuff it's also possible to create the catalog from crawling a Maven repo
Fionn
FionnOP23h ago
yepp I was able to do that locally, but not sure how I would set that up on the remote
dan1st
dan1st23h ago
that's probably the easiest if your repo tool doesn't support it
Fionn
FionnOP23h ago
still doesnt solve how to get the plugin to target the archetype thankfully its only a single archetype I want to share right now
JavaBot
JavaBot23h ago
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.
Fionn
FionnOP23h ago
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
dan1st
dan1st23h ago
?
Fionn
FionnOP23h ago
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
dan1st
dan1st23h ago
if everything is in a folder, you can set the maven repo to that folder
Fionn
FionnOP23h ago
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
dan1st
dan1st23h ago
yes, the packages would need to be relative to the repo root
Fionn
FionnOP23h ago
exactly - you cant do that in CodeArtifact gonna give up and leave it there -- my team can local install the archetype when needed 😅
dan1st
dan1st23h ago
Can you try -DarchetypeCatalog= maybe?
Fionn
FionnOP23h ago
yepp tried that thanks for walking through anyway, I'll take the defeat here 😄
JavaBot
JavaBot23h ago
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.
JavaBot
JavaBot23h ago
Post Closed
This post has been closed by <@269241887213223936>.
Want results from more Discord servers?
Add your server