Browse Source

增加zip打包方式

“林惠丽“ 3 years ago
parent
commit
4b2880d2f6
4 changed files with 81 additions and 0 deletions
  1. 49 0
      dmp-org/pom.xml
  2. 4 0
      dmp-org/src/script/start.bat
  3. 5 0
      dmp-org/src/script/start.sh
  4. 23 0
      dmp-org/src/script/zip.xml

+ 49 - 0
dmp-org/pom.xml

@@ -119,6 +119,55 @@
                     </execution>
                 </executions>
             </plugin>
+
+            <!-- 按照测试要求打成zip需要的配置 -->
+            <!--获取git信息-->
+            <plugin>
+                <groupId>pl.project13.maven</groupId>
+                <artifactId>git-commit-id-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>revision</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <verbose>true</verbose>
+                    <dateFormat>yyyyMMddHHmm</dateFormat>
+                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
+                    <!--<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>-->
+                    <generateGitPropertiesFilename>target/git.properties</generateGitPropertiesFilename>
+                </configuration>
+            </plugin>
+
+            <!-- 打包压缩 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <!-- 当执行mvn package时才会打包 -->
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>
+                                ${project.artifactId}_${git.commit.time}_git_${git.branch}_${git.commit.id.abbrev}
+                            </finalName>
+                            <!--不包含assembly id-->
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <!--输出路径-->
+                            <!--<outputDirectory>../target/co_search-${project.version}</outputDirectory>-->
+                            <descriptors>
+                                <descriptor>src/script/zip.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 

+ 4 - 0
dmp-org/src/script/start.bat

@@ -0,0 +1,4 @@
+@ECHO OFF&PUSHD %~DP0 &TITLE dmp-dic
+@ECHO 根据情况使用内存限制 命令为:
+@ECHO java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 dmp-rwd.jar
+java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 -DCONFIG_FILE_PATH=D:\SpringCloud dmp-rwd.jar

+ 5 - 0
dmp-org/src/script/start.sh

@@ -0,0 +1,5 @@
+#!/bin/sh
+# 根据情况使用内存限制 命令为:
+# nohup java -jar -Xms500m -Xmx1024m -Dfile.encoding=utf-8 dmp-org.jar >/dev/null 2>&1 &
+nohup java -jar -Xms500m -Xmx4096m -Dfile.encoding=utf-8 -DCONFIG_FILE_PATH=/mnt/data/SpringCloud dmp-org.jar >/dev/null 2>&1 &
+sleep 2

+ 23 - 0
dmp-org/src/script/zip.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.1 http://maven.apache.org/xsd/assembly-3.1.1.xsd">
+    <id>dev</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>${basedir}/target/</directory>
+            <includes>
+                <include>config/</include>
+                <include>*.jar</include>
+                <include>start.bat</include>
+                <include>start.sh</include>
+            </includes>
+            <outputDirectory>/</outputDirectory>
+        </fileSet>
+    </fileSets>
+</assembly>