您好,登錄后才能下訂單哦!
Maven 提供了豐富的插件,本文說明了maven 插件打包的步驟:
pom.xml 文件如下:
<profiles> <!-- dev環境 --> <profile> <id>dev</id> <build> <filters> <filter>log4j.dev.properties</filter> <filter>params.dev.properties</filter> </filters> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>log4j.properties</include> <include>params.properties</include> <include>dictionary.properties</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <excludes> <exclude>log4j.properties</exclude> <exclude>params.properties</exclude> </excludes> <filtering>false</filtering> </resource> </resources> </build> <activation> <activeByDefault>true</activeByDefault> <property> <name>env</name> <value>dev</value> </property> </activation> </profile> <!-- pro環境 --> <profile> <id>pro</id> <build> <filters> <filter>log4j.pro.properties</filter> <filter>params.pro.properties</filter> </filters> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>log4j.properties</include> <include>params.properties</include> <include>dictionary.properties</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <excludes> <exclude>log4j.properties</exclude> <exclude>params.properties</exclude> </excludes> <filtering>false</filtering> </resource> </resources> </build> </profile> <!-- uat環境 --> <profile> <id>uat</id> <build> <filters> <filter>log4j.uat.properties</filter> <filter>params.uat.properties</filter> </filters> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>log4j.properties</include> <include>params.properties</include> <include>dictionary.properties</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/resources</directory> <excludes> <exclude>log4j.properties</exclude> <exclude>params.properties</exclude> </excludes> <filtering>false</filtering> </resource> </resources> </build> </profile> </profiles>
params.dev.properties 是指在項目里配置的開發環境數據鏈接
params.uat.properties 是指在項目里配置的測試環境數據鏈接
params.pro.properties 是指在項目里配置的生產環境數據鏈接
params.properties 是指上面三個指定的打包的數據鏈接
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。