Maven屏蔽Parent(Module)中的Plugin

今天研究关于Presto的SPI的开发,在写好Demo之后大包的过程中发现,如下报错

INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.084 s
[INFO] Finished at: 2018-11-08T16:36:44+08:00
[INFO] Final Memory: 23M/267M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (default) on project plugin_test: Failed during checkstyle execution: Unable to find configuration file at location: /home/levin/workspcae/java/plugin_test/src/checkstyle/checks.xml: Could not find resource '/home/levin/workspcae/java/plugin_test/src/checkstyle/checks.xml'. -> [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/MojoExecutionException

上面的异常看了一下,发现是因为Parent中引用了maven-checkstyle-plugin,但是当本身Module打包的过程中,触发了其中的plugin的check,产生的报错,感觉这些都是无关的那就研究了一下如何屏蔽。
下面是屏蔽的方法贴出来

mvn clean package -Dcheckstyle.skip=true -Dcheckstyle.skipExec=true

上面的貌似只能屏蔽maven-checkstyle-plugin的check,还有一些其他的plugin,google了好多,发现下面这种方法可以使用

<build>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.gaul</groupId>
                <artifactId>modernizer-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
 </build>

在当前pom中引入想屏蔽的plugin然后添加标签 configuration以及skip属性

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
Maven 多模块脚手架搭建的步骤如下: 1. 创建一个 Maven 父级项目作为容器,使用 Maven 命令创建: ```bash mvn archetype:generate -DgroupId=com.example -DartifactId=parent -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false ``` 2. 在父级项目下创建多个子模块,每个子模块负责不同的功能模块,使用 Maven 命令创建: ```bash mvn archetype:generate -DgroupId=com.example -DartifactId=module1 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false mvn archetype:generate -DgroupId=com.example -DartifactId=module2 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false ... ``` 3. 在每个子模块的 pom.xml 文件配置依赖和插件,如数据库驱动、Spring 框架等,示例: ```xml <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>5.2.3.RELEASE</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.18</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.2.2.RELEASE</version> </plugin> </plugins> </build> ``` 4. 在父级项目的 pom.xml 文件使用 <modules> 标签将所有子模块引入,形成一个完整的项目,示例: ```xml <modules> <module>module1</module> <module>module2</module> ... </modules> ``` 5. 使用 Maven 命令进行编译、打包、部署等操作,如 mvn compile、mvn package、mvn deploy 等。 需要注意的是,Maven 多模块脚手架搭建需要考虑模块之间的依赖关系和代码复用,同时也需要遵循良好的设计原则和规范,以提高项目的可维护性和可扩展性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值