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>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.6.RELEASE</version>
|
||||
<version>2.1.7.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
|
||||
<dubbo.version>2.7.2</dubbo.version>
|
||||
<dubbo.version>2.7.3</dubbo.version>
|
||||
</properties>
|
||||
|
||||
|
||||
|
@ -47,19 +47,19 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<version>${dubbo.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<version>${dubbo.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-dependencies-zookeeper</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<version>${dubbo.version}</version>
|
||||
<type>pom</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<build.skip.assembly>false</build.skip.assembly>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.ecpark.service</groupId>
|
||||
<artifactId>usergw-api</artifactId>
|
||||
|
@ -56,7 +58,7 @@
|
|||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>1.21</version>
|
||||
<version>1.24</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -65,12 +67,6 @@
|
|||
<version>1.2.58</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.ecpark.service</groupId>
|
||||
<artifactId>usergw-api</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ctrip.framework.apollo</groupId>
|
||||
<artifactId>apollo-client</artifactId>
|
||||
|
@ -91,17 +87,42 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>cn.ecpark.service.usergw.App</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin><artifactId>maven-compiler-plugin</artifactId></plugin>
|
||||
<plugin><artifactId>maven-resources-plugin</artifactId></plugin>
|
||||
<plugin><artifactId>maven-source-plugin</artifactId></plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<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>
|
||||
<groupId>org.jacoco</groupId>
|
||||
|
|
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)
|
||||
@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 {
|
||||
|
||||
@LocalServerPort
|
||||
|
|
|
@ -13,10 +13,10 @@ import reactor.netty.http.client.HttpClient;
|
|||
import reactor.netty.http.client.HttpClient.ResponseReceiver;
|
||||
import reactor.netty.http.client.HttpClientResponse;
|
||||
|
||||
// TODO: 添加附加Dubbo Service for Test启动进程
|
||||
|
||||
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestPropertySource(locations = { "application2.properties" })
|
||||
@TestPropertySource(locations = "classpath:/resources/test2.properties", properties = {"apollo.meta=", "app.id="})
|
||||
public class TestHttp2DubboConfig2 {
|
||||
|
||||
@LocalServerPort
|
||||
|
|
|
@ -17,10 +17,10 @@ import reactor.netty.http.client.HttpClient;
|
|||
import reactor.netty.http.client.HttpClient.ResponseReceiver;
|
||||
import reactor.netty.http.client.HttpClientResponse;
|
||||
|
||||
// TODO: 添加附加Dubbo Service for Test启动进程
|
||||
|
||||
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.DEFINED_PORT)
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestPropertySource(locations = { "application3.properties" })
|
||||
@TestPropertySource(locations = "classpath:/resources/test3.properties", properties = {"apollo.meta=", "app.id="})
|
||||
public class TestHttp2DubboConfig3 {
|
||||
|
||||
@LocalServerPort
|
||||
|
|
|
@ -16,7 +16,7 @@ import reactor.netty.http.client.HttpClientResponse;
|
|||
// TODO: 添加附加Dubbo Service for Test启动进程
|
||||
@SpringBootTest(classes = App.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestPropertySource(locations = { "application4.properties" })
|
||||
@TestPropertySource(locations = "classpath:/resources/test4.properties", properties = {"apollo.meta=", "app.id="})
|
||||
public class TestHttp2DubboConfig4 {
|
||||
|
||||
@LocalServerPort
|
||||
|
|
|
@ -11,5 +11,5 @@ server.port=8888
|
|||
# logging.level.org.springframework.cloud.gateway=debug
|
||||
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.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.file=logs/log
|
||||
|
||||
yame.config=test-gateway4.yaml
|
||||
yame.gateway.config=test-gateway4.yaml
|
||||
|
Loading…
Reference in New Issue
Block a user