前言 maven-enforcer-plugin是一个规范约束maven构建环境的插件,例如Maven版本,JDK版本和OS系列以及更多内置规则和用户创建的规则,旨在统一项目的开发环境。 网上关于解决此插件报错的方案都无关痛痒,没有深入到错误的实质,故解决问题后,在此做个记录 插件地址:http://maven.apache.org/enforcer/maven-enforcer-plugin 插件rule校验失败 楼主在构建spring data jpa时maven抛了如下的异常: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin 解决问题 仔细查看日志,其实enforce是有打印日志的,往错误日志的上面一点看就会发现如下警告日志: [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce
上面这行命令大意是先清理target目录,再打包,同时跳过测试,应用dist,native这2种profile,且最终目标是生成tar包 首次编译一般不会成功(视人品而定),下面是可能会遇到的一些问题: a) maven-enforcer-plugin 规则验证失败 编辑源代码根目录下的pom.xml,找到maven-enforcer-plugin所在的部分 <plugin> <groupId>org.apache.maven.plugins </groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.3.1</version
org.apache.thrift:thrift:[0.5.0] <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin
maven-enforcer-plugin,这个强大的maven插件,配合extra-enforcer-rules工具,能自动扫描Jar包将冲突检测并打印出来,汗颜的是,笔者工作之前居然都没听过有这样一个插件的存在 在最终需要打包运行的应用模块pom中,引入maven-enforcer-plugin的依赖,在build阶段即可发现问题,并解决它。 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId extra-enforcer-rules</artifactId> <version>1.0-beta-6</version> </dependency> </dependencies> </plugin> maven-enforcer-plugin 而Extra Enforcer Rules则是MojoHaus项目下的针对maven-enforcer-plugin而开发的提供额外规则的插件,这其中就包含前面所提的重复类检测功能,具体用法可参见官网,
maven-enforcer-plugin http://maven.apache.org/plugins/maven-enforcer-plugin/ 在一个稍大一点的组织或团队中,你无法保证所有成员都熟悉 maven-enforcer-plugin的enforce目标负责检查规则,它默认绑定到生命周期的validate阶段。
extra-enforcer-rules/banDuplicateClasses.html <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin
Downloading: http://maven.aliyun.com/nexus/content/repositories/central/org/apac he/maven/plugins/maven-enforcer-plugin Downloaded: http://maven.aliyun.com/nexus/content/repositories/central/org/apach e/maven/plugins/maven-enforcer-plugin Downloading: http://maven.aliyun.com/nexus/content/repositories/central/org/apac he/maven/plugins/maven-enforcer-plugin Downloaded: http://maven.aliyun.com/nexus/content/repositories/central/org/apach e/maven/plugins/maven-enforcer-plugin
1.经过上述的步骤,我们在idea中便有了一个一个janusgraph源码的项目,我们首先去除对应的maven插件 将项目最外层的pom.xml中的插件maven-enforcer-plugin部分注释掉 ,不然会出现Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce enforce-dependency-convergence
1.经过上述的步骤,我们在idea中便有了一个一个janusgraph源码的项目,我们首先去除对应的maven插件 将项目最外层的pom.xml中的插件maven-enforcer-plugin部分注释掉 ,不然会出现Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce enforce-dependency-convergence
plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin
<pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin ,)</versionRange> </pluginExecutionFilter> <action> <ignore> <message>maven-enforcer-plugin
--- maven-clean-plugin:3.1.0:clean (default-clean) @ streampark-common_2.12 --- [INFO] [INFO] --- maven-enforcer-plugin :3.0.0:enforce (enforce-maven-version) @ streampark-common_2.12 --- [INFO] [INFO] --- maven-enforcer-plugin
maven-enforcer-plugin http://maven.apache.org/plugins/maven-enforcer-plugin/ 在一个稍大一点的组织或团队中,你无法保证所有成员都熟悉 maven-enforcer-plugin的enforce目标负责检查规则,它默认绑定到生命周期的validate阶段。
plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin
plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin
spark.shuffle.service.enabled true spark.shuffle.service.port 7337 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin 这是做环境约束检查用,到pom.xml中找到对应的enforce插件 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin
关于依赖冲突排查可借助如maven-enforcer-plugin 与Maven Helper 插件。根据实际情况及环境,选择组合最优的解决方案解决依赖冲突问题。
代码文件和资源文件 (5)maven-surefire-plugin 执行单元测试 (6)jetty-maven-plugin 内置jetty容器,可以通过命令,将项目运行在jetty容器中 (7)maven-enforcer-plugin
dubbo-rpc-api --- [INFO] Deleting /usr/src/mymaven/dubbo-rpc/dubbo-rpc-api/target [INFO] [INFO] --- maven-enforcer-plugin
常用插件: maven-antrun-plugin maven-archetype-plugin maven-assembly-plugin maven-dependency-plugin maven-enforcer-plugin