maven 常用的插件
<build>
<finalName>demowar</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<port>80</port>
</configuration>
</plugin>
</plugins>
</build>
maven-jar-plugin 打包 不会 把依赖包打包 https://blog.csdn.net/qq_40708942/article/details/124579623https://j3q80mf3ig.feishu.cn/docx/GYyWd6T9AoUnFBxKhTocRmlrnqb
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<useUniqueVersions>true</useUniqueVersions>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
<!-- main 所在路径 -->
<mainClass>com.me.demo.DemoApplication</mainClass>
</manifest>
</archive>
<outputDirectory>./dist</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>./dist/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
指定依赖包从 外部环境加载 java -Dloader.path=/app/lib2 -jar demo-0.0.1-SNAPSHOT.jar
springboot maven profile 实现打包 https://blog.csdn.net/aofengdaxia/article/details/122796184
<profiles>
<profile>
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profiles.active>prod</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
shell
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.me.fluxdemo.FluxDemoApplication</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- 默认 打出来的jar flux-demo-0.0.1-SNAPSHOT-jar-with-dependencies
false 表示去掉后缀
-->
<appendAssemblyId>false</appendAssemblyId>
<finalName>${project.build.finalName}-single.jar</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>