简体   繁体   中英

Maven build optimization - prevent building *-fat.jar locally

Right now I see this in my project:

在此处输入图片说明

I have a pretty optimized maven build using:

mvn -offline -T 9 package exec:java -DskipTests

the offline flag prevents it from looking for updates, uses 9 threads, and skips tests, but I wonder if there is a flag I can use to prevent it from creating the *-fat.jar ?

I figure the fat.jar is a big file and if I avoid creating it until I need to, might save some time.

Maven is not creating something like "-fat.jar" by default. It mast be specific definition in the pom.xml: maven-assembly-plugin or maven-shade-plugin which do it.

So, you need to change your pom.xml: define special profiles: one(defualt) which will create "-fat.jar" and one which will not.

And then you will able to run something like "mav package -Pmy-no-fat-profile" to avoid "-fat.jar" creation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM