[英]Maven Build failure in command prompt but getting build in eclipse
我正在命令提示符下使用mvn clean
命令,並且構建失敗。
Downloading:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] Reactor Summary:
[INFO] ABC ......................................... FAILURE [ 2.226 s]
[INFO] BUILD FAILURE
[INFO] Total time: 3.098 s
[INFO] Finished at: 2018-11-16T15:10:36+05:30
[INFO] Final Memory: 12M/153M
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of
its
dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer
artifact
org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central
(https://repo.maven.apache.org/maven2): Received fatal alert:
protocol_version -
> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/PluginResolutionException
但是,當我從Eclipse內部使用mvn clean
命令時,它正在成功構建。
[INFO] ---------------------------------------------------------------------
---
Downloading:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Downloaded:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.4.1/maven-clean-plugin-2.4.1.pom (5 KB at 5.2 KB/sec)
-------------------------
[INFO] BUILD SUCCESS
[INFO] Total time: 4.387s
我能看到的區別是,在命令提示符下,它正嘗試下載maven-clean-plugin-2.5,而從eclipse中,它已成功下載2.4.1。
但是我只需要運行2.5。 誰可以幫我這個事。 謝謝。
我不知道您是否在全球范圍內安裝Maven。 您可以嘗試全局安裝Maven。 按照步驟。
創建或導出M2_HOME =“ MAVEN ROOT LOCATION”。 防爆。 : E:\\ SoftwareRepo \\構建工具\\ apache-maven-3.5.2
創建或導出MAVEN bin文件夾位置到PATH變量。 例如: E:\\ SoftwareRepo \\ build tools \\ apache-maven-3.5.2 \\ bin
打開終端或cmd並運行mvn --version確認是否已安裝maven。
您可以將其與Eclipse一起使用。 然后去蝕。 並設置項目。按照此步驟
或者,您可以從終端或cmd運行Maven項目。 只需轉到項目根文件夾,然后運行諸如maven clean install之類的maven任務即可。 快樂編碼:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.