刚下载一个开源项目源码,用maven编译发现报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.:enforce (enforce-versions) on project spark-parent_2.: Some Enforcer rules
have failed. Look above for specific messages explaining why the rule failed. -> [Help ]
[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 ] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

根据报错提示信息得出是enforce插件检测规则失败,并且这里提供了一个官方解决连接,进入看看MojoExecutionException解释:

说明这个不是maven本身报错,而是它的插件报错了,并且告诉我们要去看一下插件的文档,提供了maven插件文档的链接,进入plugin index找到enforce插件,先看看这个插件是干什么的:

这里的对enforcer的解释是,这是做环境约束检查用,到pom.xml中找到对应的enforce插件:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>${maven.version}</version>
</requireMavenVersion>
<requireJavaVersion>
<version>${java.version}</version>
</requireJavaVersion>
<bannedDependencies>
<excludes>
<!--
Akka depends on io.netty:netty, which puts classes under the org.jboss.netty
package. This conflicts with the classes in org.jboss.netty:netty
artifact, so we have to ban that artifact here. In Netty .x, the classes
are under the io.netty package, so it's fine for us to depend on both
io.netty:netty and io.netty:netty-all.
-->
<exclude>org.jboss.netty</exclude>
<exclude>org.codehaus.groovy</exclude>
</excludes>
<searchTransitive>true</searchTransitive>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>

这里对java.version和maven.version做了约束,把配置改成本地对应的版本号即可。

参考:

https://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

http://maven.apache.org/plugins/

maven编译开源项目报enforce错解决的更多相关文章

  1. 使用maven编译Java项目 http://www.tuicool.com/articles/YfIfIrq

    使用maven编译Java项目 时间 2014-07-17 17:42:37  Way Lau's Blog 原文  http://www.waylau.com/build-java-project- ...

  2. 使用maven编译Java项目

    摘要: 综述 本文演示了用Maven编译Java项目 需要 时间:15分钟 文本编辑器或者IDE JDK 6 或者更高版本 创建项目 本例主要为了展示Maven,所以Java的项目力求简单. 创建项目 ...

  3. asp.net MVC webservice 报次错解决方法

    asp.net  MVC  webservice  报次错解决方法: 解决方法: 在 RouteConfig.cs public static void RegisterRoutes(RouteCol ...

  4. 解决maven编译spark1.5报错问题

    spark1.5发布了,赶紧去下了源码尝鲜 git clone git://github.com/apache/spark.git -b branch-1.5 输入命令进行编译 ./make-dist ...

  5. 利用Eclipse中的Maven构建Web项目报错(一)

    利用Eclipse中的Maven构建Web项目 1.在进行上述操作时,pom.xml一直报错 <project xmlns="http://maven.apache.org/POM/4 ...

  6. Eclipse/IDEA中使用Maven创建Web项目报错

    Eclipse中的错误:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp-1.0.jar:R ...

  7. 利用Eclipse中的Maven构建Web项目报错(二)

    利用Eclipse中的Maven构建Web项目 1.错误描述 [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.a ...

  8. maven部署tomcat项目,403错误解决

    maven部署tomcat项目时403错误的解决方法 web模块的pom文件 pom.xml <plugin> <groupId>org.apache.tomcat.maven ...

  9. 【待解决】maven创建web项目报错

    创建web项目时报错

随机推荐

  1. MySQL和SQLyog的配置-安装及遇到的问题

    1. 安装MySQL 我先是参考了菜鸟教程上的#Windows 上安装 MySQL #版块的安装教程,不过经历了种种磨难,我最后是按照#此篇博客#安装成功的. 这两篇教程最大的差别是在于下载的版本不同 ...

  2. Nginx反向代理解决iframe跨域问题

    前言 这几天有个需求:做个表单页面,要求后台人员能自定义发布表单,用户来填写表单.我一想,这不麦克表单有现成的吗,拿来就用!发布表单后,可以选择使用iframe方式嵌入网站,一切顺利. 当时的网站是h ...

  3. ReactNative之从HelloWorld中看环境搭建、组件封装、Props及State

    开篇呢,先给大家问个好,今天是中秋节,祝大家中秋节快乐!!虽然是中秋节,但是木有回家还是总结一下知识点写写博客吧,想着昨天总结一下的,但是昨天和几个同学小聚了一下,酒逢知己总是千杯少呢,喝的微醺不适合 ...

  4. cmd中输入net start mysql 提示:服务名无效或者MySQL正在启动 MySQL无法启动

    在DOS窗口.gitbush以及一些可以使用的命令行工具的界面上,输入:net stop mysql.net start mysql时,总是提示:服务名无效. 出现提示如下: 原因是:因为net st ...

  5. 微擎where范围查询in

    where sale_time in($todayStart,$todayEnd)

  6. 自己整理的所有java知识点(不断迭代中)

    1. 自己整理的所有java知识点(不断迭代中) 画图工具注册 https://www.processon.com/i/599d35fae4b00d97d7f9bb17 1.1. Java整体知识架构 ...

  7. Java相关面试题总结+答案(二)

    [容器] 18. Java 容器都有哪些? 19. Collection 和 Collections 有什么区别? Collection 是一个集合接口,它提供了对集合对象进行基本操作的通用接口方法, ...

  8. python进程和线程(五)

    python的进程 由于GIL的存在,python中的多线程其实并不是真正的多线程,如果想要充分地使用多核CPU的资源,在python中大部分情况需要使用多进程.Python提供了非常好用的多进程包m ...

  9. linux日常服务器部署一些命令使用

    今天公司的开发环境的linux服务器,我要了一个账号来玩玩 拿到账号和密码,我就用xshell登陆上去 1.查看已挂载的分区列表 df -h 显示已经挂载的分区列表 2.查看目录中的文件 ls 查看目 ...

  10. Asp .Net Core 读取appsettings.json配置文件

         Asp .Net Core 如何读取appsettings.json配置文件?最近也有学习到如何读取配置文件的,主要是通过 IConfiguration,以及在Program中初始化完成的. ...