修改打包配置

This commit is contained in:
朱毅骏 2023-04-07 19:04:12 +08:00
parent 983f0de171
commit 89dfbf29e5
2 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,39 @@
<assembly>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.md</include>
</includes>
</fileSet>
<!-- 配置文件,静态资源 -->
<fileSet>
<directory>src/main/resources/</directory>
<outputDirectory>config/${project.artifactId}</outputDirectory>
<!--权限控制与linux权限写法一致自行百度-->
<fileMode>0644</fileMode>
</fileSet>
</fileSets>
</assembly>

View File

@ -81,4 +81,64 @@
<!--=============================sms短信sdk end========================== -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<!--<outputDirectory>${jar_dir}</outputDirectory>-->
<archive>
<manifest>
<!--启动类 such as: com.test.StartApp-->
<mainClass>cn.zyjblogs.RbacApplication</mainClass>
<!-- 把所依赖的 jar 包写入 manifest -->
<addClasspath>true</addClasspath>
<!--定义依赖jar包的相对路径相对项目jar包-->
<classpathPrefix>lib/</classpathPrefix>
<useUniqueVersions>false</useUniqueVersions>
</manifest>
<manifestEntries>
<!--MANIFEST.MF 中 Class-Path 加入资源文件目录-->
<!--定义静态资源的相对路径相对项目jar包-->
<Class-Path>config/${project.artifactId}/.</Class-Path>
</manifestEntries>
</archive>
<includes>
<!-- 当前项目的 jar 包内排除静态资源 -->
<include>**/*.class</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<!--assembly配置文件的相对路径-->
<descriptor>bin/assembly.xml</descriptor>
</descriptors>
<!--assembly打包后的输出位置-->
<outputDirectory>target</outputDirectory>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>