`
H小阿飞
  • 浏览: 274407 次
  • 性别: Icon_minigender_1
  • 来自: 南通
社区版块
存档分类
最新评论

尼玛 JB的Maven资源插件

阅读更多

11-11-6 上午09时56分52秒: Build errors for pc-client; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.1:resources (default-resources) on project pc-client: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.1:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.1 or one of its dependencies could not be resolved: Missing:
----------
1) org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.codehaus.plexus -DartifactId=plexus-interactivity-api -Dversion=1.0-alpha-4 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.codehaus.plexus -DartifactId=plexus-interactivity-api -Dversion=1.0-alpha-4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
   1) org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1
   2) org.apache.maven.shared:maven-filtering:jar:1.0-beta-3
   3) org.apache.maven:maven-core:jar:2.0.6
   4) org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4

----------
1 required artifact is missing.

for artifact:
  org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.1

from the specified remote repositories:
  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)

 

     今天电脑里装了myeclipse9.1,看里面自带maven插件,就把以前做的一个maven项目给布置进去了,尼玛,后台就打出了上述英文信息,似乎说maven读取资源信息插件安装没成功吧。运行项目,总是报空指针异常信息,至于项目中说空指针异常的信息也都是找不到文件路径。后台指向的错误地方,都是this.getClass().getClassLoader()
 .getResourceAsStream("images/add.PNG")此类地方。

     依本人看,估计确实是maven插件有问题,或者说myeclipse9.1中自带的maven插件不是完全的,没有查找资源文件路径信息的插件吧。不过我测试了一下,不用maven项目,直接一个普通的java项目中,this.getClass().getClassLoader().getResourceAsStream("images/add.PNG")都能够读取到相关的路径文件,那就算maven插件有问题,应该也不会造成读取不到路径下面的文件啊,在此我有些想不通。

     现本想能不能重新安装一下maven插件,不使用9.1中自带的maven插件,找了个apache-maven-3.0.3版本的,配置了一下环境变量,在cmd命令行中敲入mvn -version也有了相关的信息。然后选择“window”->"preferences"->“MyEclipse”->"Maven4MyEclipse"->"Maven"->"Installations",此时在右端有个列表,列表右边有“Add”、“Edit”等三个按钮,选择“Add”,然后选择自己的maven的根目录,选择完后就点击“Apply”和“ok”。这一切搞定后,可是只要我引入之前的项目后台就老是输出上述英文信息,而新建一个新的maven项目也有此英文信息,可以肯定的不是我代码的问题

     以上问题的解决办法,还望能有高手指点,在下感激不尽!

 

进行了如下操作,似乎还是没有用

 

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>mvn install:install-file -DgroupId=org.c
odehaus.plexus -DartifactId=plexus-interactivity-api -Dversion=1.0-alpha-4 -Dpac
kaging=jar -Dfile=/path/to/file
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-po
m ---
[INFO] Installing C:\path\to\file to C:\Documents and Settings\Administrator\.m2
\repository\org\codehaus\plexus\plexus-interactivity-api\1.0-alpha-4\plexus-inte
ractivity-api-1.0-alpha-4.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.984s
[INFO] Finished at: Mon Dec 05 19:00:49 CST 2011
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
C:\Documents and Settings\Administrator>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.219s
[INFO] Finished at: Mon Dec 05 19:01:13 CST 2011
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
 in this directory (C:\Documents and Settings\Administrator). Please verify you
invoked Maven from the correct directory. -> [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/MissingProject
Exception

C:\Documents and Settings\Administrator>mvn deploy:deploy-file -DgroupId=org.cod
ehaus.plexus -DartifactId=plexus-interactivity-api -Dversion=1.0-alpha-4 -Dpacka
ging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.5:deploy-file (default-cli) @ standalone-pom --
-
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.938s
[INFO] Finished at: Mon Dec 05 19:36:34 CST 2011
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:
deploy-file (default-cli) on project standalone-pom: C:\path\to\file not found.
-> [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

分享到:
评论
3 楼 itliquan 2012-12-28  
这个问题,需要更新,设置一个镜像就行了...在 setting上额mirrors节点上配置

<mirror> 
      <id>UK</id> 
      <name>UK Central</name> 
      <url>http://uk.maven.org/maven2</url> 
      <mirrorOf>central</mirrorOf> 
  </mirror> 

2 楼 H小阿飞 2011-12-07  
   今天把自己的电脑全部ghost还原了一下,算比较干净的系统了。先重新安装myeclipse9.1,这安装过程中还是蛮折腾的,当安装好后,是需要进行激活和注册的,当运行注册机时,始终无法运行其注册机,而当初我第一次安装的时候却很顺利的,这次机子还原干净了装,反而却不行了,郁闷无比,于是就网上查阅,发现注册机的运行,需要32位的JDK支持,同时还有一点,就是电脑里要安装了VC 2008的运行库(这点很多人都不知道,忽略了,我的注册机运行不起来,就是这个原因导致的),上次装那么顺利,是因为那时安装myeclipse9.1时,我电脑里已经安装了 SQL SERVER2005、VS2008,肯定是那时电脑里已经有了VC 2008的运行库,而我还原干净的机子,里面没有安装运行库
    myeclipse9.1安装注册好后,继续搞里面的maven,发现还是同样有问题,看来对于myeclipse9.1中的maven插件不是SQL SERVER2005、VS2008这类软件导致冲突的,而是它自身插件有问题吧,或者是我电脑里哪里少了什么配置,就如安装myeclipse9.1后,要运行其注册机,需要有VC 2008运行库
    刚刚又重新ghost了一遍机子,都快崩溃了,都不知道ghost还原了好几遍了,再进行安装测试,这次直接不装myeclipse9.1了,直接在自己的机子上安装eclipse3.6、JDK1.7、maven插件。尼玛,还是报错:Build errors for pc-client;昨晚我在我父亲的电脑上安装了却好的,而我机子还原干净了装,却不行。现在我又开始怀疑,是我电脑里哪个系统配置不完整导致我的maven插件老是出问题,之所以这么怀疑,是因为在我机子上,无论如何,maven插件总是出问题,就算机子还原干净了再装都有问题,而在别的机子上安装eclipse的maven插件都OK。
1 楼 H小阿飞 2011-12-06  
对于以上问题,上网查阅了很多资料,怀疑过JDK版本冲突造成,把JDK1.6_18换成了JDK1.7.0,在用eclipse新建maven项目时还是报错,说maven版本之类不行的错误,错误信息如下:
Build errors for pc-client; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources) on project pc-client: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failure to transfer org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 from/to central (http://repo1.maven.org/maven2): No response received after 60000

也试过网上的方法,似乎都没法解决。看来还是自己的技术水平不够。最后实在没法子,连问题的所在都定位不了,我就在其他干净的机子上安装了eclipse、jdk、maven。居然不报错了,把以前的maven项目布置进去也不报错,可以顺利跑起来,新建maven同样没报错。所以我现在开始怀疑是否会因为我这台机子上安装了SQL SERVER2005、VS2008这类软件造成了冲突导致的,因为我是安装了此类软件后,再安装myeclipse9.1和eclipse的,按理来说,我给eclipse安装插件,方法步骤很简单,不会有啥错误的,安装过程也都对的,过程中也没出现啥问题。再有myeclipse9.1自带的maven插件也不该有问题的,而它们都偏偏同样出现了问题,所以我现在只能这样判断是其他软件造成的冲突了。

相关推荐

Global site tag (gtag.js) - Google Analytics