Dynamically Discover Maven Archetypes

In my Plugin I need to find and add User Archetypes as I want to guide the user during the Project / Module configuration. I can manually find and add the Archetypes and build the project but this is error prone.

What is the best way to find an Maven Archetype when I know its group id?

I tried this:

MavenSearcher searcher = new MavenArtifactSearcher();
List<MavenArtifactSearchResult> result = searcher.search(project, "org.apache.sling", 200);


But the project is not setup yet and so it cannot find the Maven Indices.

What I would love to do is to find all Artfiacts that have this group id and end with "archetype". Eclipse has the "ArchetypeCatalogFactory" which find all aviable archetypes. I don't need to find all archetypes but the onces in a given folder and sub folder like (org/apache/sling).

Thanks - Andy

2 comments
Comment actions Permalink

You can try to use org.jetbrains.idea.maven.indices.MavenIndicesManager#getArchetypes method to get all available archetypes and filter the set by group id.

0
Comment actions Permalink

I know but that requires the Archetypes to be added to the User Archetypes.

What I want is to parse the Remote Maven Repository to discover the Archetypes dyrnically.

What I am looking for is to find all Maven artifacts for a given Repo URL and that without a Project (as I need the Archetypes to create the Project).

- Andy

0

Please sign in to leave a comment.