Maven-FAQ

1、Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5...
Q:
第一次使用maven+eclipse(kepler),创建maven 工程后,遇到如下问题:
Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.5...
A:
在stackoverflow发现答案:
在工程的pom.xml中添加:
  1. <build>
  2. <pluginManagement>
  3. <plugins>
  4. <plugin>
  5. <groupId>org.apache.maven.plugins</groupId>
  6. <artifactId>maven-resources-plugin</artifactId>
  7. <version>2.6</version>
  8. </plugin>
  9. </plugins>
  10. </pluginManagement>
  11. </build>
问题神奇的解决。由于本人还是maven菜鸟,原因暂时不明。以后再慢慢探索吧。

2、Failed to read artifact descriptor for  xx:yy:zz:dd
Q:
如题所示。xx:yy:zz:dd表示插件的唯一坐标。
A:

1. 首先关闭 eclipse。

2. 删除repository 目录下全部东西。

3. 启动eclipse。

4. 在项目上选择maven菜单, 选择菜单中的 upate projec子菜单。 问题解决。


3、命令行手动创建maven项目失败
在windows cmd命令窗口手工键入:
E:\src\mvnex>mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch04 -Dartifa
ctId=simple-weather -DpackageName=org.sonatype.mavenbook -Dversion=1.0
创建项目失败,错误信息如下:
Q:
[ERROR] No plugin found for prefix 'archetype' in the current project and in the
 plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the
repositories [local (E:\repository\maven), central (http://repo.maven.apache.org
/maven2)] -> [Help 1]
A:
因为是在offline的情况下执行mvn命令,所以如果本地mvn仓库没有插件的话,则会创建失败。

4、使用maven install项目的时候,资源文件好像没有一起发布到目的文件夹
在对maven工程进行jar打包验证过程中,在“source folder”中的资源文件都被打包到了jar中。

5、maven 3.2 + findbugs可能导致有问题。建议使用freestyle风格,或者maven3.0.
上面链接中,findbugs的作者建议使用freestyle风格。
经过验证,果然freestyle风格的好用。下图是截图。我们可以看到,构建成功了,并且显示了FindBugs的输出。


与此对比的maven风格的输出,我们看到构建失败了:










posted @ 2014-08-08 14:30  ajupiter  阅读(511)  评论(0编辑  收藏  举报