【发布时间】:2016-08-30 14:02:17
【问题描述】:
我正在尝试使用 maven deploy-file 但不断收到此异常:
org.apache.maven.lifecycle.MissingProjectException: 你指定的目标需要一个项目来执行但是这个目录下没有POM(..)
使用这个命令:
mvn -X deploy:deploy-file \
"-DrepositoryId=Private_Snapshots" \
"-Durl=https://nexus.di2e.net/nexus/content/repositories/Private_Snapshots/" \
"-DgeneratePom=true" \
"-DgroupId=Generator" \
"-DartifactId=PConfigurator" \
"-Dversion=1.1.0.0-SNAPSHOT" \
"-Dfile=./PConfigurator.apk"
我的 settings.xml 文件包含:
<servers>
<server>
<id>Private_Snapshots</id>
<username>USERNAME</username>
<password>XXXXXXXXXXXX</password>
</server>
</servers>
如果需要 pom.xml,它会是什么样子? 谢谢
我尝试添加 -Dpackaging=android:apk 或 -Dpackaging=apk,结果相似。 deploy 和 :deploy-file 之间没有空格。这是失败的附加输出:
+ /usr/local/apache-maven/bin/mvn -X deploy:deploy-file -DrepositoryId=Private_Snapshots -Durl=https://nexus.di2e.net/nexus/content/repositories/Private_Snapshots/ -DgeneratePom=true ' '
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 13:51:28+0000)
Maven home: /usr/local/apache-maven
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_91/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-573.12.1.el6.x86_64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/apache-maven/conf/settings.xml
[DEBUG] Reading user settings from /home/jenkins/.m2/settings.xml
[DEBUG] Using local repository at /home/jenkins/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /home/jenkins/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.094s
[INFO] Finished at: Tue Aug 30 19:55:58 UTC 2016
[INFO] Final Memory: 6M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (.). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (.). Please verify you invoked Maven from the correct directory.
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
【问题讨论】:
-
您确定没有在
deploy和:deploy-file之间放置空格吗?在这种情况下,maven 会认为你调用了deploy阶段,这显然需要一个 pom 文件来执行 -
我同意@A_Di-Matteo。我似乎是最有可能的解释。 Maven 的输出应该告诉您
deploy阶段是否已激活。您能否在帖子中添加更多输出?MissingProjectException前面写的是什么? -
简单地运行
mvn deploy:deploy-file应该会抱怨丢失的文件或url。如果可行,则插件已正确执行。否则,我会查看包装。它暗示它在失败之前正在考虑这一点。
标签: maven