在使用Eclipse的Maven插件时,经常会遇到Missing artifact的编译错误,特别是在新环境中搭建相关项目时,经常出现类似此问题,今天一位同事又遇到了,经过一顿问题原因查找,始终无法解决,决定来好好研究研究此类问题,以免以后遇到此类问题。

 

以下为尝试过的办法:

1. 项目右键->Maven->Update Dependency,失败

2. 项目右键->Maven->Disable Dependency, 然后再Enable Dependency,失败

3. 将Eclipse此类项目删除掉(不删除磁盘上的文件),重新导入,问题依旧,失败

4. 将相应项目从磁盘上删除,再从SVN重新下载下来,导入,问题依旧,失败

 

在经历了以上各种尝试之后,发现问题不在这些配置上,可能是某些地方冲突导致,不甘心的在网上搜索了一下,找到一篇解决办法:http://blog.csdn.net/mydeman/article/details/6126503

分析原因说是由于其中某个jar包导致,再仔细查看我打出的日志文件之后发现,跟文章中说明的很相似,而且我第一个报错的Jar包确实也没有pom文件,如下图:

其他正常的jar包:

所以问题原因就清楚了,按照前面的解决办法需要上传相应的pom文件至nexus上去,但是不能放到私服的Central里面,只能放到3rd party,里面,而我们的项目中引用的该文件又不能随意改动,因为引用的项目太多了,暂时还找不到更好的解决办法。

在这里找到貌似可以创建pom文件的办法:

http://stackoverflow.com/questions/4906017/maven-project-build-problems

文章中这样说:

  • 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:

C:\career\tools\develop\svn\sources\v2.0\h2o\trunk\modules\utility>mvn install:i
nstall-file -DgroupId=opensymphony -DartifactId=quartz-all -Dversion=1.6.3 -Dpac
kaging=jar -Dfile=C:/career/tools/develop/maven/repositories/oecs-repository/rep
o/opensymphony/quartz-all/1.6.3
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.orientpay:op-h2o-utility:jar:2.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-comp
iler-plugin is missing. @ line 1116, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building op-h2o-utility 2.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ op-h2o-utilit
y ---
[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.399s
[INFO] Finished at: Wed Aug 06 11:36:48 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]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
C:\career\tools\develop\svn\sources\v2.0\h2o\trunk\modules\utility>

在网上搜索之后异常”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)

由于不想删除本地仓库,只能待以后有机构再尝试了,现在就这样。

 

另外找到一个Quzrtz的demo样例,http://www.mkyong.com/java/quartz-scheduler-example/,里面给出的dependency是如下的,而不是我的配置文件中的quartz-all,这可能也是为什么在maven仓库里面下不到相关pom文件:

		<dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz</artifactId>
<version>1.6.3</version>
</dependency>
但是我们的pom文件是不能修改的

[Maven] Missing artifact (解决办法)的更多相关文章

  1. 针对Eclipse的maven Missing artifact com.microsoft.sqlserver:slqjdbc4:jar:4.0

    maven 中添加sqlserver 出错,报错内容 maven Missing artifact com.microsoft.sqlserver 解决方法这里先下载好jar包 ,然后maven命令执 ...

  2. [Maven] Missing artifact

    今天从朋友那拷过来一个maven工程,eclipse中maven配置好了,maven仓库也配置完毕,但是一直报Missing artifact,然后开网执行maven update,下载完jar后,还 ...

  3. Maven Missing artifact jar

    maven error:Multiple annotations found at this line: - Missing artifact log4j:log4j:jar:1.2.15:compi ...

  4. 在Ubuntu14.04下安装运行Unity-tweak-tool报错scheme missing的解决办法

    问题: 安装完unity-tweak-tool后,打开运行弹出出错窗口,忘了截图了,提示内容: scheme missing! Error: schema com.canonical.indicato ...

  5. maven Missing artifact com.sun:tools:jar:1.5.0

    转自:http://blog.csdn.net/caolaosanahnu/article/details/7918929 http://zuoshahao.com/work/others/missi ...

  6. 解决maven项目找不到maven依赖的解决办法

    不同的IDE对应的.classpath中的maven声明也不一样,这样就会导致项目找不到maven依赖. 即Java Build Path--->Libraries中找不到Maven Depen ...

  7. Error:Cause: org/gradle/api/publication/maven/internal/DefaultMavenFactory 解决办法

    当你使用的Gradle版本是2.4以上,Android插件版本是1.3.0以上的时候就会出现这个问题,这时候你只需将android-maven-gradle-plugin插件版本改为classpath ...

  8. eclipse导入基于maven的java项目后没有Java标志和没有maven Dependencies有解决办法

    没有java标志,不识别为Java项目,右键项目-->Properties-->Project Facets-->勾选Java   确定就可以了. 没有maven Dependenc ...

  9. 关于eclipse 项目导入不了 maven依赖的解决办法

    1.首先确定你的项目是maven 项目 ,如果不是:项目右键Configure -->Convert to maven project. 2.在SVN导出的Maven项目,或以前不是用Maven ...

随机推荐

  1. 使用Gitosis搭建Git服务器

    使用Gitosis搭建Git服务器 作者: JeremyWei | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明 网址: http://weizhifeng.net/build- ...

  2. linux pep8 检查工具

    感谢dongweiming大神.

  3. c++ vector struct 使用

    1. //test.h #include <string> using namespace std; struct AA { string a1; string a2; string a3 ...

  4. eclipse添加字体

    1.打开window—>Preferences—>General—>Appeatance—>Colors and Fonts—>Text Font—>Edit 2. ...

  5. Effective C++ -----条款15:在资源管理类中提供对原始资源的访问

    APIs往往要求访问原始资源(raw resources),所以每一个RAII class应该提供一个“取得其所管理之资源”的办法. 对原始资源的访问可能经由显示转换(.get()成员函数或者指针取值 ...

  6. mybatis参数错误 Parameter '×××' not found. Available parameters are [0, 1, param1, param2]

    报错的代码 @Update("update staff_info set ApplyState = #{applyState} where Id = #{userId}") int ...

  7. 【python】lxml处理命名空间

    有如下xml <A xmlns="http://This/is/a/namespace"> <B>dataB1</B> <B>dat ...

  8. db2中报SQLCODE=-530, SQLSTATE=23503错误

    今天在写一个增加操作时,报错信息如下:SQLCODE=-530, SQLSTATE=23503,该sqlcode说明:“对特定的约束名指定了无效的外健值”. 项目中用的框架是SSH,新增的主对象有多个 ...

  9. 如何给DropDownList在后台代码中添加一个空的选项

    代码如何: ddl_dept.Items.Insert(, new ListItem("---请选择---","")); new ListItem的第一个参数表 ...

  10. Javascript 封装方法

    基本封装方法 请看下面的例子: var Person = function(name,age){ this.name = name; this.age = age || "未填写" ...