Forráskód Böngészése

恢复jar包打包方式

tianyunperfect 4 éve
szülő
commit
6d7c9e1bfb

+ 1 - 3
springboot-main/bin/boot.sh

@@ -39,9 +39,7 @@ JAVA_OPTS="$JAVA_OPTS -server "
 # 垃圾收集器、设置分层编译、
 JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:+TieredCompilation"
 # 自定义配置文件和lib目录,多个目录用冒号分割
-# 已修改为分离 lib和 resource,所以 Dloader.path暂时不用
-#JAVA_OPTS="$JAVA_OPTS -Dloader.path=config -Djava.io.tmpdir=./tmp "
-JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=./tmp "
+JAVA_OPTS="$JAVA_OPTS -Dloader.path=config -Djava.io.tmpdir=./ "
 # 服务器模式、兼容IPV4、编码(避免乱码)、禁止代码调用gc、
 JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8  -XX:+DisableExplicitGC"
 # gc 日志

+ 1 - 80
springboot-main/pom.xml

@@ -13,92 +13,13 @@
 
     <build>
         <plugins>
-            <!-- 分离lib -->
-            <plugin>
-                <!--这个插件就是把依赖的jar包复制出来放到编译后的target/lib目录,并且在打包时候排除内部依赖-->
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <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>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <!-- 分离资源文件 -->
-            <plugin>
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-resources</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <resources>
-                                <resource>
-                                    <directory>src/main/resources</directory>
-                                </resource>
-                            </resources>
-                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <!--打包jar-->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <configuration>
-                    <archive>
-                        <!-- 指定资源文件目录,与打包的jar文件同级目录 -->
-                        <manifestEntries>
-                            <Class-Path>resources/</Class-Path>
-                        </manifestEntries>
-                        <manifest>
-                            <addClasspath>true</addClasspath>
-                            <classpathPrefix>lib/</classpathPrefix>
-                            <mainClass>com.alvin.Application</mainClass>
-                        </manifest>
-                    </archive>
-                    <!-- 打包时忽略的文件(也就是不打进jar包里的文件),本例将resources下的.yml、.xml、.db文件全部排除 -->
-                    <excludes>
-                        <exclude>**/*.yml</exclude>
-                        <exclude>**/*.xml</exclude>
-                        <exclude>**/*.db</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-            <!-- spring boot repackage -->
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
+                    <fork>true</fork>
                     <layout>ZIP</layout>
-                    <includes>
-                        <include>
-                            <groupId>non-exists</groupId>
-                            <artifactId>non-exists</artifactId>
-                        </include>
-                    </includes>
                 </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
             </plugin>
         </plugins>
     </build>

+ 2 - 1
springboot-main/src/main/java/com/alvin/Application.java

@@ -15,9 +15,10 @@ public class Application implements CommandLineRunner {
     }
 
 
-
     @Override
     public void run(String... args) throws Exception {
+
         System.out.println("启动成功");
     }
+
 }