Why does not archetype:generate with parameters work for me?
Asked Answered
C

5

22

If i run mvn archetype:generate it works but if i try

mvn archetype:generate -DarchetypeGroupId org.codehaus.mojo -DarchetypeArtifactId gwt-maven-plugin  -DarchetypeVersion=2.5.0 

The message is from my last attempt with backslashes but it''s the same message for without slashes command

E:\mavenplay\a>mvn archetype:generate \ -DarchetypeGroupId org.codehaus.mojo \ -
DarchetypeArtifactId gwt-maven-plugin \ -DarchetypeVersion=2.5.0 -X
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 15:51:
28+0200)
Maven home: E:\apache-maven-3.0.5\bin\..
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: E:\Program Files\Java\jdk1.6.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from E:\apache-maven-3.0.5\bin\..\conf\settings.
xml
[DEBUG] Reading user settings from C:\Users\henkel\.m2\settings.xml
[DEBUG] Using local repository at C:\Users\henkel\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Use
rs\henkel\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (non
e)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.co
re, parent: null]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.247s
[INFO] Finished at: Sun Jun 30 03:00:22 EEST 2013
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
 in this directory (E:\mavenplay\a). Please verify you invoked Maven from the co
rrect directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requi
res a project to execute but there is no POM in this directory (E:\mavenplay\a).
 Please verify you invoked Maven from the correct directory.
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:89)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception
E:\mavenplay\a>

I have tried with / \ and no slashing. Please
let me know what other details to give.

LE: As a sidenote i did manage to create the archetype in interactive mode of course but i'm just curious why it does not work directly

Choate answered 30/6, 2013 at 0:10 Comment(1)
This is a problem with powershell. Use cmd instead.Synopsis
M
14

The = signs are missing on some parameters, try:

 mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0

You may as well specify -DgroupId=<group-id> and -DartifactId=<artifact-id> so Maven won't ask.

Metaphysic answered 30/6, 2013 at 0:18 Comment(2)
OOps...let me give it a tryChoate
I had the same issue. I think the slashes are what cause it. What worked for me was: mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.6.0Noblesse
M
107

If you are using a Windows shell you need to put quotes around the arguments like this:

mvn archetype:generate "-DarchetypeGroupId=org.codehaus.mojo" "-DarchetypeArtifactId=gwt-maven-plugin" "-DarchetypeVersion=2.5.0"

Thanks to the poster here for pointing this out.

Moulin answered 6/7, 2015 at 3:28 Comment(5)
This deserves its own Question and Answer specifically for Windows. This is my third time back to this answer in 4 years and then going "oh crap yes, that thing"Slippage
I was getting crazy almostJarret
This is a life saver. I forgotten that on windows this need to be considered. Thanks a lot!Iveson
I upvoted all the above comments just to show my relief and frustrations at the same time. This is so annoying..Attila
I second Ibic. @Glenn Lawrence: THANK YOU!Resurrectionist
M
14

The = signs are missing on some parameters, try:

 mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0

You may as well specify -DgroupId=<group-id> and -DartifactId=<artifact-id> so Maven won't ask.

Metaphysic answered 30/6, 2013 at 0:18 Comment(2)
OOps...let me give it a tryChoate
I had the same issue. I think the slashes are what cause it. What worked for me was: mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.6.0Noblesse
R
0

I encountered this identical problem, on Windows 7. The solution for me was to make sure that the path to the Maven bin subdirectory was explicitly the first thing on the path. I think that Maven is deriving the path to its configuration directory from the path to its executable, and that something on my path was pointing to another version of Maven (I'm not certain what or where) which has an invalid configuration.

So try modifying your PATH to put the correct path to the mvn executable as the first item, and see if this fixes things for you.

Rozele answered 19/5, 2014 at 13:32 Comment(0)
W
0

I was facing the same issue on linux. It happened that I had blank space on either side of = symbol. Removing these blank spaces made it work.

Warford answered 19/11, 2018 at 17:11 Comment(0)
T
0

When you are writing it in the CMD try writing it without any space before or after ':' colon

write it like this - mvn archetype:generate

Teodoor answered 24/1, 2020 at 20:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.