|
|
@@ -480,115 +480,117 @@ linux示例:tips='请不要直接使用混淆后的jar/war'</td>
|
|
|
|
|
|

|
|
|
|
|
|
-- 客户使用maven插件,打包时将项目代码和依赖的lib分开
|
|
|
-
|
|
|
- 完整pom示例:
|
|
|
-
|
|
|
- ```xml
|
|
|
- <?xml version="1.0" encoding="UTF-8"?>
|
|
|
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
|
- <modelVersion>4.0.0</modelVersion>
|
|
|
- <parent>
|
|
|
- <groupId>org.springframework.boot</groupId>
|
|
|
- <artifactId>spring-boot-starter-parent</artifactId>
|
|
|
- <version>2.6.4</version>
|
|
|
- <relativePath/> <!-- lookup parent from repository -->
|
|
|
- </parent>
|
|
|
- <groupId>com.example</groupId>
|
|
|
- <artifactId>demo</artifactId>
|
|
|
- <version>0.0.1-SNAPSHOT</version>
|
|
|
- <name>demo</name>
|
|
|
- <description>Demo project for Spring Boot</description>
|
|
|
- <properties>
|
|
|
- <java.version>1.8</java.version>
|
|
|
- </properties>
|
|
|
- <dependencies>
|
|
|
- <dependency>
|
|
|
- <groupId>org.springframework.boot</groupId>
|
|
|
- <artifactId>spring-boot-starter-web</artifactId>
|
|
|
- </dependency>
|
|
|
+ - 客户使用maven插件,打包时将项目代码和依赖的lib分开
|
|
|
+
|
|
|
+ 完整pom示例:
|
|
|
+
|
|
|
+ ```xml
|
|
|
+ <?xml version="1.0" encoding="UTF-8"?>
|
|
|
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
|
+ <modelVersion>4.0.0</modelVersion>
|
|
|
+ <parent>
|
|
|
+ <groupId>org.springframework.boot</groupId>
|
|
|
+ <artifactId>spring-boot-starter-parent</artifactId>
|
|
|
+ <version>2.6.4</version>
|
|
|
+ <relativePath/> <!-- lookup parent from repository -->
|
|
|
+ </parent>
|
|
|
+ <groupId>com.example</groupId>
|
|
|
+ <artifactId>demo</artifactId>
|
|
|
+ <version>0.0.1-SNAPSHOT</version>
|
|
|
+ <name>demo</name>
|
|
|
+ <description>Demo project for Spring Boot</description>
|
|
|
+ <properties>
|
|
|
+ <java.version>1.8</java.version>
|
|
|
+ </properties>
|
|
|
+ <dependencies>
|
|
|
+ <dependency>
|
|
|
+ <groupId>org.springframework.boot</groupId>
|
|
|
+ <artifactId>spring-boot-starter-web</artifactId>
|
|
|
+ </dependency>
|
|
|
|
|
|
- <dependency>
|
|
|
- <groupId>org.projectlombok</groupId>
|
|
|
- <artifactId>lombok</artifactId>
|
|
|
- <optional>true</optional>
|
|
|
- </dependency>
|
|
|
- <dependency>
|
|
|
- <groupId>org.springframework.boot</groupId>
|
|
|
- <artifactId>spring-boot-starter-test</artifactId>
|
|
|
- <scope>test</scope>
|
|
|
- </dependency>
|
|
|
+ <dependency>
|
|
|
+ <groupId>org.projectlombok</groupId>
|
|
|
+ <artifactId>lombok</artifactId>
|
|
|
+ <optional>true</optional>
|
|
|
+ </dependency>
|
|
|
+ <dependency>
|
|
|
+ <groupId>org.springframework.boot</groupId>
|
|
|
+ <artifactId>spring-boot-starter-test</artifactId>
|
|
|
+ <scope>test</scope>
|
|
|
+ </dependency>
|
|
|
|
|
|
- <dependency>
|
|
|
- <groupId>com.demo</groupId>
|
|
|
- <artifactId>encrypted-lib-no-pwd</artifactId>
|
|
|
- <scope>system</scope>
|
|
|
- <version>1.0.0</version>
|
|
|
- <systemPath>${pom.basedir}/src/main/resources/lib/encrypted-lib-no-pwd-1.0.0.jar</systemPath>
|
|
|
- </dependency>
|
|
|
- </dependencies>
|
|
|
+ <dependency>
|
|
|
+ <groupId>com.demo</groupId>
|
|
|
+ <artifactId>encrypted-lib-no-pwd</artifactId>
|
|
|
+ <scope>system</scope>
|
|
|
+ <version>1.0.0</version>
|
|
|
+ <systemPath>${pom.basedir}/src/main/resources/lib/encrypted-lib-no-pwd-1.0.0.jar</systemPath>
|
|
|
+ </dependency>
|
|
|
+ </dependencies>
|
|
|
|
|
|
- <build>
|
|
|
- <plugins>
|
|
|
- <plugin>
|
|
|
- <groupId>org.springframework.boot</groupId>
|
|
|
- <artifactId>spring-boot-maven-plugin</artifactId>
|
|
|
- <configuration>
|
|
|
- <!-- 指定该Main Class为全局的唯一入口 -->
|
|
|
- <mainClass>com.ideaaedi.demo.DemoApplication</mainClass>
|
|
|
- <!-- 把systemPath指定的jar包也纳入lib -->
|
|
|
- <includeSystemScope>true</includeSystemScope>
|
|
|
- <fork>true</fork>
|
|
|
- <!-- 设置为ZIP,此模式下spring-boot-maven-plugin会将MANIFEST.MF文件中的Main-Class设置为org.springframework.boot.loader.PropertiesLauncher -->
|
|
|
- <layout>ZIP</layout>
|
|
|
- <includes>
|
|
|
- <include>
|
|
|
- <groupId>nothing</groupId>
|
|
|
- <artifactId>nothing</artifactId>
|
|
|
- </include>
|
|
|
- </includes>
|
|
|
- </configuration>
|
|
|
- <executions>
|
|
|
- <execution>
|
|
|
- <goals>
|
|
|
- <goal>repackage</goal>
|
|
|
- </goals>
|
|
|
- </execution>
|
|
|
- </executions>
|
|
|
- </plugin>
|
|
|
+ <build>
|
|
|
+ <plugins>
|
|
|
+ <plugin>
|
|
|
+ <groupId>org.springframework.boot</groupId>
|
|
|
+ <artifactId>spring-boot-maven-plugin</artifactId>
|
|
|
+ <configuration>
|
|
|
+ <!-- 指定该Main Class为全局的唯一入口 -->
|
|
|
+ <mainClass>com.ideaaedi.demo.DemoApplication</mainClass>
|
|
|
+ <!-- 把systemPath指定的jar包也纳入lib -->
|
|
|
+ <includeSystemScope>true</includeSystemScope>
|
|
|
+ <fork>true</fork>
|
|
|
+ <!-- 设置为ZIP,此模式下spring-boot-maven-plugin会将MANIFEST.MF文件中的Main-Class设置为org.springframework.boot.loader.PropertiesLauncher -->
|
|
|
+ <layout>ZIP</layout>
|
|
|
+ <includes>
|
|
|
+ <include>
|
|
|
+ <groupId>nothing</groupId>
|
|
|
+ <artifactId>nothing</artifactId>
|
|
|
+ </include>
|
|
|
+ </includes>
|
|
|
+ </configuration>
|
|
|
+ <executions>
|
|
|
+ <execution>
|
|
|
+ <goals>
|
|
|
+ <goal>repackage</goal>
|
|
|
+ </goals>
|
|
|
+ </execution>
|
|
|
+ </executions>
|
|
|
+ </plugin>
|
|
|
|
|
|
- <!-- 通过插件将所有依赖的lib包放到编译后的target/lib目录,并且在打包时候排除内部依赖 -->
|
|
|
- <plugin>
|
|
|
- <groupId>org.apache.maven.plugins</groupId>
|
|
|
- <artifactId>maven-dependency-plugin</artifactId>
|
|
|
- <version>3.2.0</version>
|
|
|
- <executions>
|
|
|
- <execution>
|
|
|
- <id>copy-dependencies</id>
|
|
|
- <phase>prepare-package</phase>
|
|
|
- <goals>
|
|
|
- <goal>copy-dependencies</goal>
|
|
|
- </goals>
|
|
|
- <configuration>
|
|
|
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
|
|
|
- <overWriteReleases>false</overWriteReleases>
|
|
|
- <overWriteSnapshots>false</overWriteSnapshots>
|
|
|
- <overWriteIfNewer>true</overWriteIfNewer>
|
|
|
- <includeScope>runtime</includeScope>
|
|
|
- </configuration>
|
|
|
- </execution>
|
|
|
- </executions>
|
|
|
- </plugin>
|
|
|
- </plugins>
|
|
|
- </build>
|
|
|
+ <!-- 通过插件将所有依赖的lib包放到编译后的target/lib目录,并且在打包时候排除内部依赖 -->
|
|
|
+ <plugin>
|
|
|
+ <groupId>org.apache.maven.plugins</groupId>
|
|
|
+ <artifactId>maven-dependency-plugin</artifactId>
|
|
|
+ <version>3.2.0</version>
|
|
|
+ <executions>
|
|
|
+ <execution>
|
|
|
+ <id>copy-dependencies</id>
|
|
|
+ <phase>prepare-package</phase>
|
|
|
+ <goals>
|
|
|
+ <goal>copy-dependencies</goal>
|
|
|
+ </goals>
|
|
|
+ <configuration>
|
|
|
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
|
|
|
+ <overWriteReleases>false</overWriteReleases>
|
|
|
+ <overWriteSnapshots>false</overWriteSnapshots>
|
|
|
+ <overWriteIfNewer>true</overWriteIfNewer>
|
|
|
+ <!-- 如果你想把systemPath指定的jar包也纳入lib,可以设置includeScope为compile -->
|
|
|
+ <!-- <includeScope>compile</includeScope> -->
|
|
|
+ <includeScope>runtime</includeScope>
|
|
|
+ </configuration>
|
|
|
+ </execution>
|
|
|
+ </executions>
|
|
|
+ </plugin>
|
|
|
+ </plugins>
|
|
|
+ </build>
|
|
|
|
|
|
- </project>
|
|
|
- ```
|
|
|
+ </project>
|
|
|
+ ```
|
|
|
|
|
|
- 打出来的包:
|
|
|
+ 打出来的包:
|
|
|
|
|
|
- 
|
|
|
+ 
|
|
|
|
|
|
- 客户可以这样启动项目
|
|
|
|