add: 修改Pom Assembly设置, 完美打包scripts.
fix: test的设置, 使unittest可以根据不同配置变量启动测试
This commit is contained in:
parent
e7dacaa09b
commit
b5a19c78cf
10
pom.xml
10
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.1.6.RELEASE</version>
|
<version>2.1.7.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
|
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
|
||||||
<dubbo.version>2.7.2</dubbo.version>
|
<dubbo.version>2.7.3</dubbo.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,19 +47,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
<version>2.7.1</version>
|
<version>${dubbo.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo</artifactId>
|
<artifactId>dubbo</artifactId>
|
||||||
<version>2.7.2</version>
|
<version>${dubbo.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo-dependencies-zookeeper</artifactId>
|
<artifactId>dubbo-dependencies-zookeeper</artifactId>
|
||||||
<version>2.7.1</version>
|
<version>${dubbo.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|
|
@ -17,9 +17,11 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
<build.skip.assembly>false</build.skip.assembly>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.ecpark.service</groupId>
|
<groupId>cn.ecpark.service</groupId>
|
||||||
<artifactId>usergw-api</artifactId>
|
<artifactId>usergw-api</artifactId>
|
||||||
|
@ -56,7 +58,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
<version>1.21</version>
|
<version>1.24</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -64,12 +66,6 @@
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.58</version>
|
<version>1.2.58</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.ecpark.service</groupId>
|
|
||||||
<artifactId>usergw-api</artifactId>
|
|
||||||
<version>${project.parent.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ctrip.framework.apollo</groupId>
|
<groupId>com.ctrip.framework.apollo</groupId>
|
||||||
|
@ -91,17 +87,42 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>cn.ecpark.service.usergw.App</mainClass>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin><artifactId>maven-compiler-plugin</artifactId></plugin>
|
||||||
|
<plugin><artifactId>maven-resources-plugin</artifactId></plugin>
|
||||||
|
<plugin><artifactId>maven-source-plugin</artifactId></plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
</plugin>
|
<version>3.1.1</version>
|
||||||
<plugin>
|
<executions>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<execution>
|
||||||
</plugin>
|
<id>make-assembly</id>
|
||||||
<plugin>
|
<phase>package</phase>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<goals>
|
||||||
</plugin>
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
|
||||||
|
<!-- <descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs> -->
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
|
@ -129,4 +150,4 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
45
usergw-service/src/main/assembly/assembly.xml
Normal file
45
usergw-service/src/main/assembly/assembly.xml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
|
<id>assembly</id>
|
||||||
|
<formats>
|
||||||
|
<format>dir</format>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<includeBaseDirectory>false</includeBaseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/assembly/scripts</directory>
|
||||||
|
<outputDirectory>bin</outputDirectory>
|
||||||
|
<fileMode>0755</fileMode>
|
||||||
|
<filtered>true</filtered>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
<fileSet>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<outputDirectory>config</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>*.properties</include>
|
||||||
|
<include>gateway.yaml</include>
|
||||||
|
</includes>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.build.directory}</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>*.jar</include>
|
||||||
|
</includes>
|
||||||
|
</fileSet>
|
||||||
|
|
||||||
|
</fileSets>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <dependencySets>
|
||||||
|
<dependencySet>
|
||||||
|
<outputDirectory>/lib</outputDirectory>
|
||||||
|
<useProjectArtifact>true</useProjectArtifact>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependencySet>
|
||||||
|
</dependencySets> -->
|
||||||
|
</assembly>
|
10
usergw-service/src/main/assembly/scripts/run.bat
Normal file
10
usergw-service/src/main/assembly/scripts/run.bat
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
@echo off & setlocal enabledelayedexpansion
|
||||||
|
set BIN_DIR=%~dp0
|
||||||
|
|
||||||
|
::run
|
||||||
|
cd %BIN_DIR%\..
|
||||||
|
set APP_JAR=""
|
||||||
|
for %%f in (*-*-*.jar) do set APP_JAR=%%f
|
||||||
|
java -Dloader.path=config -Dfile.encoding=UTF-8 -Xms256m -Xmx512m -jar %APP_JAR%
|
||||||
|
cd %BIN_DIR%
|
||||||
|
|
8
usergw-service/src/main/assembly/scripts/run.sh
Normal file
8
usergw-service/src/main/assembly/scripts/run.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
##cnf
|
||||||
|
APP_PMS="-Xms256m -Xmx512m"
|
||||||
|
APP_JAR=`echo *-*-*.jar`
|
||||||
|
##run
|
||||||
|
cur=$(dirname $(readlink -f "$0")) && cd $cur/..
|
||||||
|
|
||||||
|
exec java -Dloader.path=config -Dfile.encoding=UTF-8 ${APP_PMS} -jar ${APP_JAR}
|
|
@ -18,7 +18,7 @@ import reactor.netty.http.client.HttpClientResponse;
|
||||||
|
|
||||||
@SpringBootTest(classes= App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(classes= App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource(locations = "classpath:/resources/test.properties", properties = {"apollo.meta=", "app.id="})
|
@TestPropertySource(locations = "classpath:/resources/test1.properties", properties = {"apollo.meta=", "app.id="})
|
||||||
public class TestHttp2DubboConfig {
|
public class TestHttp2DubboConfig {
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
|
|
|
@ -13,10 +13,10 @@ import reactor.netty.http.client.HttpClient;
|
||||||
import reactor.netty.http.client.HttpClient.ResponseReceiver;
|
import reactor.netty.http.client.HttpClient.ResponseReceiver;
|
||||||
import reactor.netty.http.client.HttpClientResponse;
|
import reactor.netty.http.client.HttpClientResponse;
|
||||||
|
|
||||||
// TODO: 添加附加Dubbo Service for Test启动进程
|
|
||||||
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource(locations = { "application2.properties" })
|
@TestPropertySource(locations = "classpath:/resources/test2.properties", properties = {"apollo.meta=", "app.id="})
|
||||||
public class TestHttp2DubboConfig2 {
|
public class TestHttp2DubboConfig2 {
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
|
|
|
@ -17,10 +17,10 @@ import reactor.netty.http.client.HttpClient;
|
||||||
import reactor.netty.http.client.HttpClient.ResponseReceiver;
|
import reactor.netty.http.client.HttpClient.ResponseReceiver;
|
||||||
import reactor.netty.http.client.HttpClientResponse;
|
import reactor.netty.http.client.HttpClientResponse;
|
||||||
|
|
||||||
// TODO: 添加附加Dubbo Service for Test启动进程
|
|
||||||
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.DEFINED_PORT)
|
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.DEFINED_PORT)
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource(locations = { "application3.properties" })
|
@TestPropertySource(locations = "classpath:/resources/test3.properties", properties = {"apollo.meta=", "app.id="})
|
||||||
public class TestHttp2DubboConfig3 {
|
public class TestHttp2DubboConfig3 {
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
|
|
|
@ -16,7 +16,7 @@ import reactor.netty.http.client.HttpClientResponse;
|
||||||
// TODO: 添加附加Dubbo Service for Test启动进程
|
// TODO: 添加附加Dubbo Service for Test启动进程
|
||||||
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@TestPropertySource(locations = { "application4.properties" })
|
@TestPropertySource(locations = "classpath:/resources/test4.properties", properties = {"apollo.meta=", "app.id="})
|
||||||
public class TestHttp2DubboConfig4 {
|
public class TestHttp2DubboConfig4 {
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
|
|
|
@ -11,5 +11,5 @@ server.port=8888
|
||||||
# logging.level.org.springframework.cloud.gateway=debug
|
# logging.level.org.springframework.cloud.gateway=debug
|
||||||
logging.file=logs/log
|
logging.file=logs/log
|
||||||
|
|
||||||
yame.config=test-gateway2.yaml
|
yame.gateway.config=test-gateway2.yaml
|
||||||
|
|
|
@ -11,5 +11,5 @@ server.port=8888
|
||||||
# logging.level.org.springframework.cloud.gateway=debug
|
# logging.level.org.springframework.cloud.gateway=debug
|
||||||
logging.file=logs/log
|
logging.file=logs/log
|
||||||
|
|
||||||
yame.config=test-gateway3.yaml
|
yame.gateway.config=test-gateway3.yaml
|
||||||
|
|
|
@ -17,5 +17,5 @@ server.port=8888
|
||||||
# logging.level.org.springframework.cloud.gateway=debug
|
# logging.level.org.springframework.cloud.gateway=debug
|
||||||
logging.file=logs/log
|
logging.file=logs/log
|
||||||
|
|
||||||
yame.config=test-gateway4.yaml
|
yame.gateway.config=test-gateway4.yaml
|
||||||
|
|
Loading…
Reference in New Issue
Block a user