Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, thanks for answering :)</p> <p>Today I'm trying to get a better understanding of how archetypes works looking at the tutorial on maven <a href="http://maven.apache.org/guides/mini/guide-creating-archetypes.html" rel="nofollow noreferrer">here</a>, althought is still very disapointing.</p> <p>My problem is that I am having a build failure in maven when I try to do the mvn archetype:generate instruction. This is, as simple as possible, my problem. The build problem says that 'The defined artifact is not an archetype'. </p> <p>I have tried the decreapted instruction archetype:create and the error is more or less the same but it adds that 'Embedded error: The META-INF/maven/archetype.xml descriptor cannot be found.' In my archetype there is an archetype.xml so it seems that the decreapted instruction is decreapted for a good reason.</p> <p>My total instruction is at follows</p> <pre><code>mvn archetype:generate -DgroupId=my_groupid -DartifactId=my_artifactid -Dversion=1.0 -DarchetypeGroupId=archetype-foo-lib -DarchetypeArtifactId=my.archetype.foo -DarchetypeVersion=1.0 -DarchetypeRepository=C:/.m2/repository -Dbasedir=C:/.m2/repository/archetype-foo-lib -B -DinteractiveMode=false </code></pre> <p>In basedir I have the pom.xml and the dom4j.jar and the repository is up (in a little tomcat server). Also, the archetype is installed and the archetypegroupid, archetypeartifacid and archetypeversion are the same as the one in the src\main\resources\archetype-resources folder. I also tried to change the slashes to '\' in the basedir (just in case) with no better results.</p> <p>As I am now trying to do it directly in maven console you can forget about the webapp project and all that stuff. I can hopefully make it work there once it starts working in the console.</p> <p>Alas! Also I have the stacktrace (as I have also done this with -e parameter)</p> <pre><code>+ Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class =&gt; 'org.codehaus.plexus .velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on =&gt; 'false'. [INFO] Setting property: resource.loader =&gt; 'classpath'. [INFO] Setting property: resource.manager.logwhenfound =&gt; 'false'. [INFO] [archetype:generate {execution: default-cli}] [INFO] Generating project in Batch mode [INFO] Archetype defined by properties [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] The defined artifact is not an archetype [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.BuildFailureException: The defined artifact is not an archetype at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa ultLifecycleExecutor.java:715) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone Goal(DefaultLifecycleExecutor.java:569) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau ltLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan dleFailures(DefaultLifecycleExecutor.java:387) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen ts(DefaultLifecycleExecutor.java:284) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi fecycleExecutor.java:180) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:6 0) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoFailureException: The defined artifact is not an archetype at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu te(CreateProjectFromArchetypeMojo.java:201) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi nManager.java:490) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa ultLifecycleExecutor.java:694) ... 17 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Tue Mar 30 11:08:59 CEST 2010 [INFO] Final Memory: 8M/15M [INFO] ------------------------------------------------------------------------ </code></pre> <p>Since the repository could be bad, I have also changed the -Darchetyperepository to c:.m2\repository but it also fails myserably to acomplish something diferent.</p> <p>I hope this post is more insightfull.</p> <p>Thanks for all :) Random</p> <p>Edit: Ok, new data. I am know investigating why it seems to not be an archetype, and it seems that mvn archetype:generate -DarchetypeCatalog=local has 0 archetypes. So it appears that it's not installed. I have done the mvn install and the mvn archetype:crawl but it doesn't work. Any ideas why it doesn't let me install my own archetypes? Thanks again :)</p> <p>Edit Again: Problem with local archetypes resolved, I had to move the archetype-catalog.xml from ~/.m2/repository/ to ~/.m2/ and then just like that Maven found my local archetypes. Strange off all, it still gives me the same error. I have also changed my archetype repository and base dir.</p> <p>Last Edit (I hope so!): well, I finally found the error. It's so stupid I feel my self ashemed to write t down (it's been three days by know becouse of this). My archetypeArtifactId and my archetypeGroupId where exchanged (I mean, one was the other). Once I started passing the corrtect parameters (defined in archetype-catalog.xml that, although, I still had to move to the correct place) it started to do wonders. Thanks too all peoplo who read or wrote :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload