maven 从特定module(项目)重新开始编译

前言

一般情况下,多module的项目数量过少,可能不需要使用到这个功能,但是当项目过多就很有必要,例如有20个module 编译到最后一个报错了,那重新构建的话 就会从第一个项目再来一遍,是不是很烦躁。

实践

要从特定的某个module(项目)开始重新编译,可以使用Maven的-rf标志(resume from),指定从特定项目重新开始编译。

java 复制代码
# xx 标识从哪个项目开始编译
mvn -U clean package -Dmaven.test.skip=true  -rf :xx

示例 现在项目有个报错

java 复制代码
[INFO] Reactor Summary:
[INFO]
[INFO] datax-all 0.0.1-SNAPSHOT ........................... SUCCESS [ 0.137 s]
[INFO] datax-common 0.0.1-SNAPSHOT ........................ SUCCESS [ 9.469 s]
[INFO] datax-transformer 0.0.1-SNAPSHOT ................... SUCCESS [ 5.269 s]
[INFO] datax-core 0.0.1-SNAPSHOT .......................... FAILURE [ 10.520 s]
[INFO] plugin-rdbms-util 0.0.1-SNAPSHOT ................... SKIPPED
[INFO] mysqlreader 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] drdsreader 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] sqlserverreader 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] postgresqlreader 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] kingbaseesreader 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] oraclereader 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] cassandrareader 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] oceanbasev10reader 0.0.1-SNAPSHOT .................. SKIPPED
[INFO] obhbasereader 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] rdbmsreader 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] odpsreader 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] otsreader 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] otsstreamreader 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] hbase11xreader 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] hbase094xreader 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] hbase11xsqlreader 0.0.1-SNAPSHOT ................... SKIPPED
[INFO] hbase20xsqlreader 0.0.1-SNAPSHOT ................... SKIPPED
[INFO] plugin-unstructured-storage-util 0.0.1-SNAPSHOT .... SKIPPED
[INFO] hdfsreader 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] ossreader 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] ftpreader 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] txtfilereader 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] streamreader 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] clickhousereader 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] mongodbreader 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] tdenginewriter 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] tdenginereader 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] gdbreader 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] tsdbreader 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] opentsdbreader 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] loghubreader 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] datahubreader 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] starrocksreader 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] sybasereader 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] dorisreader 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] mysqlwriter 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] starrockswriter 1.1.0 .............................. SKIPPED
[INFO] drdswriter 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] databendwriter 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] oraclewriter 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] sqlserverwriter 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] postgresqlwriter 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] kingbaseeswriter 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] odpswriter 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] adswriter 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] oceanbasev10writer 0.0.1-SNAPSHOT .................. SKIPPED
[INFO] obhbasewriter 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] adbpgwriter 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] hologresjdbcwriter 0.0.1-SNAPSHOT .................. SKIPPED
[INFO] rdbmswriter 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] hdfswriter 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] osswriter 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] otswriter 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] hbase11xwriter 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] hbase094xwriter 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] hbase11xsqlwriter 0.0.1-SNAPSHOT ................... SKIPPED
[INFO] hbase20xsqlwriter 0.0.1-SNAPSHOT ................... SKIPPED
[INFO] kuduwriter 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] ftpwriter 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] txtfilewriter 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] streamwriter 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] elasticsearchwriter 0.0.1-SNAPSHOT ................. SKIPPED
[INFO] mongodbwriter 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] ocswriter 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] tsdbwriter 0.0.1-SNAPSHOT .......................... SKIPPED
[INFO] gdbwriter 0.0.1-SNAPSHOT ........................... SKIPPED
[INFO] oscarwriter 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] loghubwriter 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] datahubwriter 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] cassandrawriter 0.0.1-SNAPSHOT ..................... SKIPPED
[INFO] clickhousewriter 0.0.1-SNAPSHOT .................... SKIPPED
[INFO] doriswriter 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] selectdbwriter 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] adbmysqlwriter 0.0.1-SNAPSHOT ...................... SKIPPED
[INFO] sybasewriter 0.0.1-SNAPSHOT ........................ SKIPPED
[INFO] neo4jwriter 0.0.1-SNAPSHOT ......................... SKIPPED
[INFO] gaussdbreader 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] gaussdbwriter 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] datax-example 0.0.1-SNAPSHOT ....................... SKIPPED
[INFO] datax-example-core 0.0.1-SNAPSHOT .................. SKIPPED
[INFO] datax-example-streamreader 0.0.1-SNAPSHOT .......... SKIPPED
[INFO] datax-example-neo4j 0.0.1-SNAPSHOT ................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.910 s
[INFO] Finished at: 2024-08-21T15:27:52+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default) on project datax-core: Failed to create assembly: Error creating assembly archive : chmod exit code was: 1 -> [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]

可以看到 编译到第四个项目 datax-core 报错了 那我下次想从datax-core开始编译 就可以使用如下命令

java 复制代码
# 这样就会从datax-core 项目开始编译 而不是从第一个项目开始编译 大大减少编译时间
mvn -U clean package assembly:assembly -Dmaven.test.skip=true  -rf :datax-core

good day !!!

相关推荐
天使day7 小时前
Maven
java·maven
smile-yan13 小时前
Provides transitive vulnerable dependency maven 提示依赖存在漏洞问题的解决方法
java·maven
果冻的猿宇宙13 小时前
Maven 中央仓库访问过慢的解决方案--设置国内镜像
maven·镜像·仓库·aliyun·国内镜像·mirror
哆啦 AI 梦13 小时前
【Maven】如何解决Maven循环依赖?
maven·循环依赖
Earnest~13 小时前
Maven极简安装&配置-241223
java·maven
皮蛋很白13 小时前
Maven 环境变量 MAVEN_HOME 和 M2_HOME 区别以及 IDEA 修改 Maven repository 路径全局
java·maven·intellij-idea
w_31234541 天前
自定义一个maven骨架 | 最佳实践
java·maven·intellij-idea
哆啦 AI 梦1 天前
【Maven】Maven的classpath
maven·classpath
CodeChampion1 天前
61.基于SpringBoot + Vue实现的前后端分离-在线动漫信息平台(项目+论文)
java·vue.js·spring boot·后端·node.js·maven·idea
新手小袁_J1 天前
JDK11下载安装和配置超详细过程
java·spring cloud·jdk·maven·mybatis·jdk11