Springboot fatjar package simple record

Simply record the springboot fatjar packaging

  • Do not use maven-assembly-plugin, but use spring-boot-maven-plugin. The coexistence of the two may cause problems, just one
  • Note the use of maven-jar-plugin to exclude content that does not need to be packaged, especially files with sensitive information about the test environment such as application-dev.properties

The following is the schematic content

</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<excludes>
						<exclude>**/application-dev.properties</exclude>
						<exclude>**/env.properties</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<fork>true</fork>
					<mainClass>${start-class}</mainClass>
					<!-- <mainClass>elasticjob.operation.simplejob.JobChangeListenerMain</mainClass> -->

				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- <plugin> -->
			<!-- <groupId>org.apache.maven.plugins</groupId> -->
			<!-- <artifactId>maven-assembly-plugin</artifactId> -->
			<!-- <version>2.5.5</version> -->
			<!-- <configuration> -->
			<!-- <archive> -->
			<!-- <manifest> -->
			<!-- <addClasspath>true</addClasspath> -->
			<!-- <mainClass>elasticjob.operation.simplejob.JobChangeListenerMain</mainClass> -->
			<!-- </manifest> -->
			<!-- </archive> -->
			<!-- <descriptorRefs> -->
			<!-- <descriptorRef>jar-with-dependencies</descriptorRef> -->
			<!-- </descriptorRefs> -->
			<!-- </configuration> -->
			<!-- <executions> -->
			<!-- <execution> -->
			<!-- <id>make-assembly</id> -->
			<!-- <phase>package</phase> -->
			<!-- <goals> -->
			<!-- <goal>single</goal> -->
			<!-- </goals> -->
			<!-- </execution> -->
			<!-- </executions> -->
			<!-- </plugin> -->
		</plugins>
	</build>

Guess you like

Origin blog.csdn.net/weixin_40455124/article/details/113667066