我正在尝试使用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
答案 0 :(得分:0)
我有同样的问题。我删除了命令中的反斜杠然后它工作了。所以你的命令就是这样:
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"