久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

常見的Maven報錯原因是什么及怎么解決

217次閱讀
沒有評論

共計 4638 個字符,預計需要花費 12 分鐘才能閱讀完成。

這篇文章主要介紹“常見的 Maven 報錯原因是什么及怎么解決”的相關知識,丸趣 TV 小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“常見的 Maven 報錯原因是什么及怎么解決”文章能幫助大家解決問題。

報錯:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

解決方法

問題是將 JRE 作為 JDK 使用了,解決辦法是安裝 JDK,并將 JDK 設置到 Installed JREs 中

圖示

錯誤堆棧

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project hibernate: Compilation failure[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -  [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] 
[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/MojoFailureException

Failed to transfer http://xx.xx. Error code 400, Repository version policy: RELEASE does not allow metadata in path: cn/blueboz/train/hibernate/0.0.1-SNAPSHOT/maven-metadata.xml – [Help 1]

問題原因

如果是 deploy 出現問題,那么可能是因為將部署路徑寫錯,如本例子,錯誤在于將 SNAPSHOT 版本寫成 RELEASE 版本

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project hibernate: Failed to retrieve remote metadata cn.blueboz.train:hibernate:0.0.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata cn.blueboz.train:hibernate:0.0.1-SNAPSHOT/maven-metadata.xml from/to blueboz-snapshots (http://bluebozpc:8081/repository/maven-releases): Failed to transfer http://bluebozpc:8081/repository/maven-releases/cn/blueboz/train/hibernate/0.0.1-SNAPSHOT/maven-metadata.xml. Error code 400, Repository version policy: RELEASE does not allow metadata in path: cn/blueboz/train/hibernate/0.0.1-SNAPSHOT/maven-metadata.xml -  [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] 
[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/MojoExecutionException

#

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project hibernate: Failed to deploy artifacts: Could not transfer artifact cn.blueboz.train:hibernate:jar:0.0.1-20170319.142156-1 from/to blueboz-snapshots (http://bluebozpc:8081/repository/maven-snapshots): Access denied to http://bluebozpc:8081/repository/maven-snapshots/cn/blueboz/train/hibernate/0.0.1-SNAPSHOT/hibernate-0.0.1-20170319.142156-1.jar. Error code 401, Unauthorized -  [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] 
[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/MojoExecutionException

新建項目卡頓問題

將 maven 的配置設置為 offline, 離線更新就可以了

Fail to transfer …錯誤

Failure to transfer 
 org.codehaus.plexus:plexus-archiver:jar:3.4
 was cached in the local repository, 
 resolution will not be reattempted until 
 the update interval of [Bsdn] has elapsed or updates are forced. 
 Original error: 
 org.codehaus.plexus:plexus-archiver:jar:3.4 
 Bsdn (http://nexus.bsdn.org/content/groups/public/): No response received after 60000

一般是因為 nexus 私服鏈接超時,建議直接換一個私服即可,在用戶路徑下的 setting 中,修改成 aliyun 的私服

  mirror 
  id Alibaba /id 
  mirrorOf central /mirrorOf 
  name AliyunMaven /name 
  url http://maven.aliyun.com/nexus/content/groups/public/ /url /mirror

實在不行的話,根據 GAV,定位到本地緩存目錄,將

\M2_HOME.m2\repository\org\codehaus\plexus\plexus-archiver\3.4

目錄下的資源刪掉,重新 UpdateProject 即可

Update Project 的時候變成 J2SE1.4

這個問題,網上提供了兩種方案先給出代碼,如果嘗試了之后發現可以的話,請按照這種方式解決。如果還是不行,請看我的第三種終極解決方案

1. 解決方法一

$HOME 目錄下的.m2 目錄下的 settings.xml 文件的 profiles 節點下添加如下信息。Jdk 版本

profile  
  id jdk1.8 /id  
  activation  
  activeByDefault true /activeByDefault  
  jdk 1.8 /jdk  
  /activation  
  properties  
  maven.compiler.source 1.8 /maven.compiler.source  
  maven.compiler.target 1.8 /maven.compiler.target  
  maven.compiler.compilerVersion 1.8 /maven.compiler.compilerVersion  
  /properties   /profile

2. 解決方法二

在 build- pluginManager 下添加,或修改 maven-compiler-plugin 的默認配置信息

plugin 
  artifactId maven-compiler-plugin /artifactId 
  version 3.7.0 /version 
  configuration 
  source 1.8 /source 
  target 1.8 /target 
  /configuration /plugin

3. 更新插件方法

必須前面兩個方法都嘗試了之后,還是無效的情況下。才可以。這時候,你必須考慮是不是你的 IDE 的問題了。筆者使用的是 EclipseKepler 版本,最高支持 Jdk7。

點擊進入 EclipseMarketPlace,輸入 Maven

JavaTm 8 support for m2e for Eclipse Kepler SR2,安裝就可以了,建議還是翻墻安裝快些

關于“常見的 Maven 報錯原因是什么及怎么解決”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識,可以關注丸趣 TV 行業資訊頻道,丸趣 TV 小編每天都會為大家更新不同的知識點。

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-18發表,共計4638字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 霸州市| 泸定县| 苍梧县| 莱芜市| 巴楚县| 吴桥县| 东乌| 阜南县| 竹溪县| 庐江县| 黑山县| 平泉县| 绥宁县| 南陵县| 班玛县| 勃利县| 金川县| 交口县| 博白县| 普定县| 孝义市| 新昌县| 冷水江市| 裕民县| 江阴市| 彭州市| 新乐市| 峨山| 绥棱县| 赣榆县| 吉水县| 安庆市| 海盐县| 苗栗县| 杭锦后旗| 新和县| 贡觉县| 白朗县| 成都市| 荥阳市| 泰兴市|