Howdy, well, maven-archetype is not core packaging (is not "built in"), so to make Maven "aware" of it, you need to use extension as explained here: https://maven.apache.org/archetype/archetype-packaging/
HTH Tamas On Wed, Oct 11, 2023 at 7:40 PM David Karr <davidmichaelk...@gmail.com> wrote: > Any more thoughts about this? I think the key clue is at the end of my > previous response, indicating that it doesn't even recognize that packaging > type. That clearly means there are unexpected versions of something being > used here, but I'm not sure what it would be. > > On Mon, Oct 9, 2023 at 10:56 AM David Karr <davidmichaelk...@gmail.com> > wrote: > > > Ok, I'll address some points in order. My current command line is this: > > ---------------------- > > mvn -e archetype:generate -DgroupId=com.att.idp > -DartifactId=MyApplication > > -Dpackage=com.att.idp -DarchetypeGroupId=com.att.idse > > -DarchetypeArtifactId=idse-springmvc-archetype > > -DarchetypeVersion=2.0.0-SNAPSHOT > > -------------------------- > > > > And this is a relevant excerpt of the pom.xml from the archetype: > > -------------- > > <groupId>com.att.idse</groupId> > > <artifactId>idse-springmvc-archetype</artifactId> > > <version>2.0.0-SNAPSHOT</version> > > > > <name>IDP Jersey Archetype</name> > > <description>Maven Archetype for creating the IDP microservices > > project</description> > > > > <packaging>jar</packaging> > > ---------------------------------------- > > > > Note that it uses the "jar" packaging, but I'll come back to that later > in > > this message. > > > > Running this results in the following: > > -------------------------- > > 10:41:09 [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] > > org.apache.maven.lifecycle.LifecycleExecutionException: 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 > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:215) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:156) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:148) > > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject > > (LifecycleModuleBuilder.java:117) > > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject > > (LifecycleModuleBuilder.java:81) > > at > > > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build > > (SingleThreadedBuilder.java:56) > > at org.apache.maven.lifecycle.internal.LifecycleStarter.execute > > (LifecycleStarter.java:128) > > at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) > > at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) > > at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) > > at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972) > > at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293) > > at org.apache.maven.cli.MavenCli.main (MavenCli.java:196) > > at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native > > Method) > > at jdk.internal.reflect.NativeMethodAccessorImpl.invoke > > (NativeMethodAccessorImpl.java:62) > > at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke > > (DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke (Method.java:566) > > at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced > > (Launcher.java:282) > > at org.codehaus.plexus.classworlds.launcher.Launcher.launch > > (Launcher.java:225) > > at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode > > (Launcher.java:406) > > at org.codehaus.plexus.classworlds.launcher.Launcher.main > > (Launcher.java:347) > > Caused by: org.apache.maven.plugin.MojoFailureException: The defined > > artifact is not an archetype > > at > > org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute > > (CreateProjectFromArchetypeMojo.java:225) > > at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo > > (DefaultBuildPluginManager.java:137) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:210) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:156) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:148) > > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject > > (LifecycleModuleBuilder.java:117) > > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject > > (LifecycleModuleBuilder.java:81) > > at > > > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build > > (SingleThreadedBuilder.java:56) > > at org.apache.maven.lifecycle.internal.LifecycleStarter.execute > > (LifecycleStarter.java:128) > > at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) > > at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) > > at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) > > at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972) > > at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293) > > at org.apache.maven.cli.MavenCli.main (MavenCli.java:196) > > at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native > > Method) > > at jdk.internal.reflect.NativeMethodAccessorImpl.invoke > > (NativeMethodAccessorImpl.java:62) > > at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke > > (DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke (Method.java:566) > > at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced > > (Launcher.java:282) > > at org.codehaus.plexus.classworlds.launcher.Launcher.launch > > (Launcher.java:225) > > at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode > > (Launcher.java:406) > > at org.codehaus.plexus.classworlds.launcher.Launcher.main > > (Launcher.java:347) > > Caused by: > > > org.apache.maven.archetype.exception.ArchetypeGenerationConfigurationFailure: > > The defined artifact is not an archetype > > at > > > org.apache.maven.archetype.ui.generation.DefaultArchetypeGenerationConfigurator.configureArchetype > > (DefaultArchetypeGenerationConfigurator.java:171) > > at > > org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute > > (CreateProjectFromArchetypeMojo.java:209) > > at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo > > (DefaultBuildPluginManager.java:137) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:210) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:156) > > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > > (MojoExecutor.java:148) > > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject > > (LifecycleModuleBuilder.java:117) > > at > > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject > > (LifecycleModuleBuilder.java:81) > > at > > > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build > > (SingleThreadedBuilder.java:56) > > at org.apache.maven.lifecycle.internal.LifecycleStarter.execute > > (LifecycleStarter.java:128) > > at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) > > at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) > > at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) > > at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972) > > at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293) > > at org.apache.maven.cli.MavenCli.main (MavenCli.java:196) > > at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native > > Method) > > at jdk.internal.reflect.NativeMethodAccessorImpl.invoke > > (NativeMethodAccessorImpl.java:62) > > at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke > > (DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke (Method.java:566) > > at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced > > (Launcher.java:282) > > at org.codehaus.plexus.classworlds.launcher.Launcher.launch > > (Launcher.java:225) > > at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode > > (Launcher.java:406) > > at org.codehaus.plexus.classworlds.launcher.Launcher.main > > (Launcher.java:347) > > ----------------------------- > > > > Next, if we attempt to change the "packaging" to "maven-archetype" as you > > state, and as shown in the examples, I get this when I try to "mvn > install" > > that: > > ---------- > > Unknown packaging: maven-archetype @ line 14, column 13 > > ---------- > > > > I am using Maven v3.8.2. I tried testing with v3.9.2, and it gets the > same > > error. > > > > > > On Sat, Oct 7, 2023 at 3:05 AM Herve Boutemy <hbout...@apache.org> > wrote: > > > >> it looks you're getting an issue finding your archetype jar in your > local > >> repository, and the message is misleading: I'd love to improve it > >> > >> can you share the stacktrace of your failed execution (add -e to your > >> command line)? > >> > >> You can in parallel look at simple archetypes source code, to see the > >> happy path, like > >> https://maven.apache.org/archetypes/maven-archetype-simple/ and its > >> source > >> > https://github.com/apache/maven-archetypes/tree/master/maven-archetype-simple > >> > >> look at its pom.xml (that has maven-archetype packaging): I hope your > own > >> archetype project uses this packaging), do "mvn install" to install > >> 1.5-SNAPSHOT, and "mvn archetype:generate > >> -DarchetypeGroupId=org.apache.maven.archetypes > >> -DarchetypeArtifactId=maven-archetype-simple > >> -DarchetypeVersion=1.5-SNAPSHOT" to generate a project from it > >> > >> Regards, > >> > >> Hervé > >> > >> On 2023/10/06 16:11:36 David Karr wrote: > >> > Thanks for the responses. I've gone through this, but I still don't > see > >> a > >> > solution. > >> > > >> > In our archetype project, I am running the > >> "archetype:create-from-project" > >> > goal and then running "mvn install", and then referencing the > installed > >> > archetype in a work directory, which fails with the given error. I'm > >> > thinking that running "c-f-p" in the root of the archetype project is > >> not > >> > exactly what is required, but I have no idea. > >> > > >> > I still have no idea why it's saying it's not an archetype, but I > >> imagine > >> > you would conclude the same thing. > >> > > >> > On Thu, Oct 5, 2023 at 4:32 PM Herve Boutemy <hbout...@apache.org> > >> wrote: > >> > > >> > > reading the mini guide > >> > > > https://maven.apache.org/guides/mini/guide-creating-archetypes.html > >> > > I see that it mixes the archetype = the jar that is stored to the > >> > > repository and the archetype project = the Maven project that will > >> create > >> > > the archetype jar > >> > > > >> > > please look at the schema in the plugin page: > >> > > https://maven.apache.org/archetype/maven-archetype-plugin/ > >> > > It shows the full lifecycle: > >> > > - from an eventual sample project > >> > > - to an archetype project > >> > > - to the built archetype > >> > > - an finally to the project generated from the archetype > >> > > and it lists the goals of the maven-artifact-plugin to go from one > >> step to > >> > > the next one > >> > > > >> > > The mini guide only covers writing the archetype project by hand, > and > >> > > building it to get the archetype jar > >> > > > >> > > I hope this will help understanding the wider logic, before digging > >> into > >> > > eventual bugs or not clear messages when something gets wrong > >> > > > >> > > Regards, > >> > > > >> > > Hervé > >> > > > >> > > On 2023/10/05 23:15:50 Herve Boutemy wrote: > >> > > > documentation probably also needs love: > >> > > > you found the mini-guide, but not the plugin reference > documentation > >> > > that explains much more: > >> > > > https://maven.apache.org/archetype/maven-archetype-plugin/index.html > >> > > > > >> > > > I'm not sure mini guide was updated as it should > >> > > > > >> > > > Regards, > >> > > > > >> > > > Hervé > >> > > > > >> > > > On 2023/10/05 20:38:20 David Karr 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? > >> > > > > > >> > > > > >> > > > > >> --------------------------------------------------------------------- > >> > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > >> > > > For additional commands, e-mail: users-h...@maven.apache.org > >> > > > > >> > > > > >> > > > >> > > > --------------------------------------------------------------------- > >> > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > >> > > For additional commands, e-mail: users-h...@maven.apache.org > >> > > > >> > > > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > >> For additional commands, e-mail: users-h...@maven.apache.org > >> > >> >