1. Problem scenario
Project update, upload the entire jar package, too large, resulting in long upload time, update or upgrade too slow.
2. Solutions
1) Store jars that are not updated frequently in a separate folder LIBS.
2) Frequently updated jars are typed as one jar.
3、 pom.xml to configure
1) The final jar package contains the updated jar package
2) Folder LIBS kicks out jars that are often updated
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
<excludeGroupIds>com.mp,com.mp.common.spring,com.mp.common.util</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>ZIP</layout>
<includes>
<include>
<groupId>com.mp</groupId>
<artifactId>mp-dispatch-service-api</artifactId>
</include>
<include>
<groupId>com.mp.common.spring</groupId>
<artifactId>common-spring-jpa</artifactId>
</include>
<include>
<groupId>com.mp.common.spring</groupId>
<artifactId>common-spring-base</artifactId>
</include>
<include>
<groupId>com.mp.common.util</groupId>
<artifactId>common-util</artifactId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
Read More:
- The introduction of third-party jar package in mavn project results in classnotfoundexception
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- How to turn your project into a jar package in idea
- Zip to decompress the jar package, like the add file in the jar package
- Research on Maven management of Java project pom.xml The jar package error is reported, but the project is running normally
- Idea Maven project uses package to package and report error (package does not exist)
- Maven compilation error: package does not exist jar package does not exist
- The spring boot project directly replaces the referenced jar package
- Solution of error report in springboot Maven package websocket
- Error splitting file: file too large solution
- Error in plot.new() : figure margins too large
- Unknown error in POM file of springboot project
- The jar package download of Maven project appears (could not transfer artifact. Org mybatis:mybatis )
- Mybatis idea environment integration jar package
- Error in Maven packaging web project: webxml attribute is required (or pre existing WEB-INF)/ web.xml if executing in update)
- [solution] the resource file cannot be found in the jar package of Java
- mysql5.7.26:[ERR] 1118 – Row size too large (> 8126)
- Java project cannot import entity class package and service package, controller layer reports error, fix project setup is OK
- Springboot project start swagger prompt error err_ CONNECTION_ Refused solution
- When Maven hits the jar package, an error is reported when executing install, and the symbol cannot be found in a line