zoukankan      html  css  js  c++  java
  • 使用autoconfig

    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

  • 相关阅读:
    apiCode/1/1.1/1.1.1
    ZOJ 3195 Design the city LCA转RMQ
    IOS学习之路十二(UITableView下拉刷新页面)
    ASP.NET 缓存技术分析
    电信支撑系统
    android提权
    awk
    linux高效shell命令总结
    C关键字typedef及argc,argv,env参数含义
    2013年6月编程语言排行榜,C语言位据第一位
  • 原文地址:https://www.cnblogs.com/diegodu/p/8617032.html
Copyright © 2011-2022 走看看