1.導入插件
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<!--springboot的maven插件-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.1.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2.打包
cmd運行
mvn clean package install 完成打包
3.獲取運行環境
spring:
cloud:
config:
uri: http://127.0.0.1:1299 #配置服務器
label: master #分支
name: plat-provider-application #github上面名稱
# profile: test #環境
profile: ${spring.actives.profile} #獲取運行的參數
cmd 輸入
java -jar -Dspring.actives.profile=test xxx-1.0-SNAPSHOT.jar
--測試
在ereuka7001注冊中心查看服務名稱即可