0
我試圖使用Maven部署文件,但不斷收到此異常:行家部署文件需要一個項目來執行,但沒有POM文件找到
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-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之前它說了什麼? – Daniel
只需運行'mvn deploy:deploy-file'應該抱怨丟失的文件或url。如果這樣,插件會正確執行。否則,我會查看包裝。這有點暗示它在失敗之前正在考慮這一點。 –