mvn package -P test 打包時,打不到test裏的配置

工程是java service

使用 maven 、assembly打包

問題: 使用mvn package -P test、mvn package -P prd 打包時,使終打的是默認的配置文件,打不到test.properties\prd.properties文件中去

問題代碼在pom.xml中的配置

<profile>
            <id>test</id>
            <build>
                <filters>
                    <filter>profile.test.properties</filter>
                </filters>
                <resources></resources>
            </build>
        </profile>

 

解決辦法,修改pom.xml中,<resouces></resources>配置屬性文件地址。再運行,就可以根據不同配置文件打包了。

<profile>
            <id>test</id>
            <build>
                <filters>
                    <filter>profile.test.properties</filter>
                </filters>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>

                    </resource>
                </resources>
            </build>
        </profile>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章