第一次用maven创建项目,运行mvn compile报错

dwk126 2014-09-05 10:48:51
第一次用maven创建项目,运行mvn compile报错,好像是缺少 maven-resources-plugin-2.6.jar 这个jar包。

这个问题去网上查是加入下面这个配置,但是还是不能解决问题,网上找的解决办法都是这种类似的。

添加这个配置内容报错的信息是没有找到 dependency 这个标签。。。第一次用实在不知道怎么用。。

添加的配置:

<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</dependency>


已经从头删除.m2文件还是同样的问题,我不知道是不是电信网络问题。

网上的解决办法:http://blog.csdn.net/imlmy/article/details/8268293

报错内容:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-01 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.234 s
[INFO] Finished at: 2014-09-05T09:57:26+08:00
[INFO] Final Memory: 2M/6M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [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/PluginResolutionException



pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">


<modelVersion>4.0.0</modelVersion>
<groupId>zttc.itat.maven</groupId>
<artifactId>maven-01</artifactId>
<version>0.0.1-SNAPSHOT</version>

<!--添加的网上的配置-->
<!--
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</dependency>
-->
</project>



环境是windows 这些都是在命令行下操作的。
...全文
17039 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yst蓝草 2017-02-12
  • 打赏
  • 举报
回复
1.检查setting.xml中配置<localRepository> D:\m2\repository </localRepository>。 2.我也是这个错误,使用的是maven 3.3.9,后来换成 maven 3.0.5 就好了(jdk 1.7 Myeclipse10)。
windows2 2015-09-10
  • 打赏
  • 举报
回复
我也遇到这个问题,原因是maven的中央仓库没法访问 解决方法是修改conf/settings.xml,设mirror为http://mirrors.ibiblio.org/pub/mirrors/maven2 参考下http://blog.csdn.net/shycx/article/details/7726600
Yeehua 2015-08-31
  • 打赏
  • 举报
回复
引用 8 楼 hewei314599782 的回复:
这个问题我找到了,你们是不是删掉过D:\Pro\Java\jdk1.6.0_43\jre\lib\security 的cecert 。复制一个默认的过来就好了
顶 我是改了这个cacerts这个文件,还原就好了
hewei+ 2015-07-23
  • 打赏
  • 举报
回复
这个问题我找到了,你们是不是删掉过D:\Pro\Java\jdk1.6.0_43\jre\lib\security 的cecert 。复制一个默认的过来就好了
lisongli2 2014-12-14
  • 打赏
  • 举报
回复
怎么样,现在解决了吗? 我也遇到同样的问题,求助啊! 楼主好人!
LinYingQiang 2014-10-11
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelVersion>4.0.0</modelVersion> <groupId>com.juvenxu.mvnbook</groupId> <artifactId>hello-world</artifactId> <version>1.0-SNAPSHOT</version> <name>Maven Hello World Project</name> <dependencies> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> </dependency> </dependencies> </project>
dwk126 2014-09-06
  • 打赏
  • 举报
回复
自己顶。。。
dwk126 2014-09-05
  • 打赏
  • 举报
回复
可能不小心删了,还是报同样的错。
引用 2 楼 yyywyr 的回复:
外面的<dependencies>标签呢? <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> </dependencies>
dwk126 2014-09-05
  • 打赏
  • 举报
回复
可能不小心删了,还是报同样的错。


[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-01 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.360 s
[INFO] Finished at: 2014-09-05T16:25:53+08:00
[INFO] Final Memory: 2M/6M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [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:

残缺的孤独 2014-09-05
  • 打赏
  • 举报
回复
外面的<dependencies>标签呢? <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> </dependencies>
dwk126 2014-09-05
  • 打赏
  • 举报
回复
自己顶

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧