1. 增加maven 依赖
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<mockito-all.version>1.10.19</mockito-all.version>
<spring-boot.version>1.5.9.RELEASE</spring-boot.version>
<maven-antrun.version>1.8</maven-antrun.version>
<pandora-boot.version>-release</pandora-boot.version>
<pandora-boot-maven-plugin.version>xxx</pandora-boot-maven-plugin.version>
<autoconfig-maven-plugin.version>1.2-fixcompress-SNAPSHOT</autoconfig-maven-plugin.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun.version}</version>
</plugin>
<plugin>
<groupId>com.taobao.pandora</groupId>
<artifactId>pandora-boot-maven-plugin</artifactId>
<version>${pandora-boot-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.alibaba.citrus.tool</groupId>
<artifactId>autoconfig-maven-plugin</artifactId>
<version>${autoconfig-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<build>
<plugins>
<plugin>
<groupId>com.taobao.pandora</groupId>
<artifactId>pandora-boot-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
</goals> </execution>
</executions>
</plugin>
<plugin>
<groupId>com.alibaba.citrus.tool</groupId>
<artifactId>autoconfig-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>autoconfig</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 解压fat jar到target/${project-name}目录 -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<unzip
src="${project.build.directory}/${project.build.finalName}.${project.packaging}"
dest="${project.build.directory}/abc" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
auto-config.xml 内容
<?xml version="1.0" encoding="UTF-8"?>
<config>
<group name="default">
<property name="spring.profiles.active" defaultValue="local" description="config env"/>
</group>
<script>
<generate template="application.properties"/>
</script>
</config>
application.properties 内容
project.name=sdfs
spring.profiles.active=${spring.profiles.active}
-Dautoconfig.userProperties=/abc/def/antx.properties