Howdy,

Sadly, archetype is in pretty bad shape. I have a PR as WIP (dropped it a
while ago) https://github.com/apache/maven-archetype/pull/148 but will pick
it up.

In short, few responses, but I think these may be better off on the related
issue...

Historically, archetype (plugin but the project whole, as in
https://github.com/apache/maven-archetype ) underwent several iterations,
each improving it in some way, and trying to retain back (and back-back,
later about this) compatibility, that resulted in a bit of a mess.
Currently, we have "maven archetype", "old maven archetype" and "older
maven archetype" (no kidding), see here:

https://github.com/apache/maven-archetype/blob/master/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java#L33
https://github.com/apache/maven-archetype/blob/master/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java#L81
https://github.com/apache/maven-archetype/blob/master/archetype-common/src/main/java/org/apache/maven/archetype/common/Constants.java#L83

And all of these kinda affect how archetype behaves (and what Maven
Archetype Plugin expects and does).

Regarding the related JIRA issue, I _think_ (assume) the problem is that
user mixes "old" (2.4) archetype plugin to consume archetypes, while
creates them with "new" (3.x) archetype plugin, that produces new ones (it
only supports consumption of old ones). Hence, for "old" plugins the "new"
archetypes are not recognized.

For start, I'd recommend to align (ideally to latest) all your plugins from
beginning (producing archetypes) to end (consuming archetypes).

HTH
Tamas

On Thu, Oct 5, 2023 at 10:38 PM David Karr <davidmichaelk...@gmail.com>
wrote:

> I support and maintain a platform used by a couple hundred
> SpringBoot/JAX-RS/Maven/K8S services.  When new services are created, a
> Maven archetype is used to create the service skeleton.  This has worked
> fine for quite a while.
>
> We're now working on a variation using SpringMVC instead of JAX-RS, and
> eventually making that the default.
>
> One of my team members took the existing Jersey/JAX-RS archetype project,
> made a copy, and then changed a bunch of things for SpringMVC instead of
> JAX-RS.  We installed that archetype in our local maven repo for initial
> testing, using "mvn install".
>
> We run a command line like the following:
>
>     mvn archetype:generate -DgroupId=com.org.idp -DartifactId=MyApplication
> -Dpackage=com.org.idp -DarchetypeGroupId=com.org.idse
> -DarchetypeArtifactId=idse-springmvc-archetype
> -DarchetypeVersion=2.0.0-SNAPSHOT
>
> The "archetypeVersion" property value corresponds to the version attribute
> in the pom.xml of the archetype.
>
> This produces the following output:
> --------------------
>  [INFO] Generating project in Batch mode
> [WARNING] Archetype not found in any catalog. Falling back to central
> repository.
> [WARNING] Add a repository with id 'archetype' in your settings.xml if
> archetype's repository is elsewhere.
> Downloading from nexus:
>
> https://repocentral.it.att.com:8443/nexus/content/groups/att-public-group/com/att/idse/idse-springmvc-archetype/2.0.0-SNAPSHOT/maven-metadata.xml
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time:  52.232 s
> [INFO] Finished at: 2023-10-04T13:33:46-07:00
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate
> (default-cli) on project standalone-pom: The defined artifact is not an
> archetype -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
> --------------------
>
> This doesn't tell me WHY it thinks this is not an archetype.
>
> I find some confusing docs about creating and installing archetypes.
>
> I found this page:
> https://maven.apache.org/guides/mini/guide-creating-archetypes.html .
> This example is curious, as the pom.xml for the archetype references the
> "archetype-packaging" extension, but the text says nothing about this. In
> fact, it clearly says "All you need to specify is a groupId, artifactId and
> version". Neither our working archetype or the new one references that
> extension.
>
> I also found this issue:
> https://issues.apache.org/jira/browse/ARCHETYPE-529
> . No one ever responded to this, so perhaps the reporter is way off. I see
> that this mentions the "create-from-project" goal. This is not mentioned in
> the previous doc page.
>
> What else can I look at to debug this problem?
>

Reply via email to