如果我运行mvn原型:生成它可以工作,但如果我尝试
mvn archetype:generate -DarchetypeGroupId org.codehaus.mojo -DarchetypeArtifactId gwt-maven-plugin -DarchetypeVersion=2.5.0
该消息来自我最后一次尝试使用反斜杠,但它与无斜杠命令的消息相同
E:mavenplaya>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.5bin..
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: E:Program FilesJavajdk1.6.0_25jre
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.5bin..confsettings.
xml
[DEBUG] Reading user settings from C:Usershenkel.m2settings.xml
[DEBUG] Using local repository at C:Usershenkel.m2repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:Use
rshenkel.m2repository
[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:mavenplaya). 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:mavenplaya).
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:mavenplaya>
我试过了,但没有砍伤。请
让我知道其他细节。
LE:顺便说一句,我确实设法在交互模式下创建了原型,但我只是好奇为什么它不能直接工作
如果您使用的是Windows shell,则需要在参数周围加引号,如下所示:
mvn archetype:generate "-DarchetypeGroupId=org.codehaus.mojo" "-DarchetypeArtifactId=gwt-maven-plugin" "-DarchetypeVersion=2.5.0"
感谢这里的海报指出了这一点。
某些参数上缺少=
符号,请尝试:
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0
您还可以指定-DgroupId=<group-id>
和-DartifactId=<artifact-id>
,这样Maven就不会问了。
我在Windows7上遇到了同样的问题。对我来说,解决方案是确保Maven bin子目录的路径明确地是路径上的第一件事。我认为Maven是从其可执行文件的路径派生到其配置目录的路径,而我的路径上的某个东西指向了另一个配置无效的Maven版本(我不确定是什么或在哪里)。
因此,尝试修改您的PATH,将mvn可执行文件的正确路径作为第一项,看看这是否为您修复了问题。
我在linux上也遇到了同样的问题。碰巧我在=符号的两边都有空格。去掉这些空白使它发挥了作用。
在CMD中写入时,请尝试在":"冒号之前或之后不留任何空格地写入
这样写-mvn原型:生成