# 项目的jar文件名称
libPath=package.jar
# 依赖包的位置
for jar in lib/*.jar
do
libPath=${libPath}:${jar}
done
echo ${libPath}
# main 函数的全名
java -cp ${libPath} com.paultech.MainClass
使用Spring Boot Thin Launcher
<plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><dependencies><dependency><!-- 加入该配置,使用maven package,依赖jar不会打包在项目最终jar文件内 --><groupId>org.springframework.boot.experimental</groupId><artifactId>spring-boot-thin-layout</artifactId><version>1.0.12.RELEASE</version></dependency></dependencies></plugin><!-- 加入该配置,maven package执行时会在target目录整理好依赖包 --><plugin><groupId>org.springframework.boot.experimental</groupId><artifactId>spring-boot-thin-maven-plugin</artifactId><version>1.0.12.RELEASE</version><executions><execution><!-- Download the dependencies at build time --><id>resolve</id><goals><goal>resolve</goal></goals><inherited>false</inherited></execution></executions></plugin></plugins>
Comments | NOTHING