[Maven]Missingartifact(解决办法)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
[Maven]Missingartifact(解决办法)
在使⽤Eclipse的Maven插件时,经常会遇到Missing artifact的编译错误,特别是在新环境中搭建相关项⽬时,经常出现类似此问题,今天⼀位同事⼜遇到了,经过⼀顿问题原因查找,始终⽆法解决,决定来好好研究研究此类问题,以免以后遇到此类问题。
以下为尝试过的办法:
1. 项⽬右键->Maven->Update Dependency,失败
2. 项⽬右键->Maven->Disable Dependency,然后再Enable Dependency,失败
3. 将Eclipse此类项⽬删除掉(不删除磁盘上的⽂件),重新导⼊,问题依旧,失败
4. 将相应项⽬从磁盘上删除,再从SVN重新下载下来,导⼊,问题依旧,失败
分析原因说是由于其中某个jar包导致,再仔细查看我打出的⽇志⽂件之后发现,跟⽂章中说明的很相似,⽽且我第⼀个报错的Jar包确实也没有pom⽂件,如下图:
其他正常的jar包:
所以问题原因就清楚了,按照前⾯的解决办法需要上传相应的pom⽂件⾄nexus上去,但是不能放到私服的Central⾥⾯,只能放到3rd party,⾥⾯,⽽我们的项⽬中引⽤的该⽂件⼜不能随意改动,因为引⽤的项⽬太多了,暂时还找不到更好的解决办法。
在这⾥找到貌似可以创建pom⽂件的办法:
⽂章中这样说:
Manually install each dependant jars using the maven install:install-file command in the local repository. This will
automatically create the poms for the jars and thus make it available to maven in subsequent runs.
使⽤maven install:install-file会⾃动创建poms,尝试这种办法之后,在项⽬⽬录下⾯执⾏此命令报错access is denied:
在⽹上搜索之后异常”access is denied“之后,修复该问题需要将本地仓库清空,再执⾏命令
根据上⾯的提⽰信息,可以在命令末尾添加-X: 在debug模式运⾏,⽽使⽤-e: 查看full stack错误信息,为了看到更加详细的信息,加上-X之后打印如下:
[DEBUG] (f) packaging = jar
[DEBUG] (f) repositoryLayout = default
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] (f) version = 1.6.3
[DEBUG] -- end configuration --
[DEBUG] Installing generated POM
[INFO] Installing C:\career\tools\develop\maven\repositories\oecs-repository\rep
o\opensymphony\quartz-all\1.6.3 to C:\career\tools\maven\repositories\oecs-repos
itory\repo\opensymphony\quartz-all\1.6.3\quartz-all-1.6.3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.938s
[INFO] Finished at: Wed Aug 06 12:07:56 CST 2014
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3
.1:install-file (default-cli) on project op-h2o-utility: Error installing artifa
ct 'opensymphony:quartz-all:jar': Failed to install artifact opensymphony:quartz
-all:jar:1.6.3: C:\career\tools\develop\maven\repositories\oecs-repository\repo\
opensymphony\quartz-all\1.6.3 (Access is denied) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-install-plugin:2.3.1:install-file (default-cli) on
project op-h2o-utility: Error installing artifact 'opensymphony:quartz-all:jar'
: Failed to install artifact opensymphony:quartz-all:jar:1.6.3: C:\career\tools\
develop\maven\repositories\oecs-repository\repo\opensymphony\quartz-all\1.6.3 (A
ccess is denied)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
由于不想删除本地仓库,只能待以后有机构再尝试了,现在就这样。
<dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz</artifactId>
<version>1.6.3</version>
</dependency>
但是我们的pom⽂件是不能修改的。