刚下载一个开源项目源码,用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. Vue(day7)

    一.环境搭建 下面我们需要为后面要做的Vue项目搭建开发环境. 1.基本的运行环境 该项目使用node& vue在webpack环境下进行开发.首先安装基本的模块文件: npm install ...

  2. [WP]BugkuCtf - pwn2

    1.首先运行一下该程序 2.我们权限不够于是去修改一下权限(改前,改后) 3.改后我们重新运行一下(123是输入的语句) 4.拖进IDA,查看字符串,此处应该就是得到flag的地方 5.之后我们查看m ...

  3. 由浅入深讲述MVVM

    相信首次听说MVVM的人,内心都是充满疑惑的!这是个嘛???能干嘛??? MVVM是Model-View-ViewModel的简写.它本质上就是MVC (Model-View- Controller) ...

  4. 【Android Studio安装部署系列】二十一、Android studio将项目上传到github中

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 概述 两个相关概念:git和github Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理.Git ...

  5. ES 07 - Elasticsearch查询文档的六种方法

    目录 1 Query String Search(查询串检索) 2 Query DSL(ES特定语法检索) 3 Query Filter(过滤检索) 4 Full Text Search(全文检索) ...

  6. [翻译] 对正在使用EF6x开发人员的一些话

    Entity Framework Core in Action Entityframework Core in action是 Jon P smith 所著的关于Entityframework Cor ...

  7. Elasticsearch.Net、Nest批量插入BulkAll

    demo地址:BulkAll 批量导入 实现目标:想要使用ElasticSearch的 .Net Api客户端NEST批量导入数据,并发异步高效的批量导入 NEST提供了BulkAll 不废话,上代码 ...

  8. javascript中的typeof和类型判断

    typeof ECMAScript 有 5 种原始类型(primitive type),即 Undefined.Null.Boolean.Number 和 String.我们都知道可以使用typeof ...

  9. OO第二次博客作业——电梯调度

    OO第二次博客作业——电梯调度 前言 最近三周,OO课程进入多线程学习阶段,主要通过三次电梯调度作业来学习.从单部电梯的傻瓜式调度到有性能要求的调度到多部电梯的调度,难度逐渐提升,对同学们的要求逐渐变 ...

  10. Java学习点滴——Integer缓存

    前言 一切从下面这段代码开始 public static void test(String[] agrs){ Integer a = 1; Integer b = 2; System.out.prin ...