maven profile

          1、執(zhí)行:mvn -P[profile_id]
          2、激活activation

          <project>
            
            
          <profiles>
              
          <profile>
                
          <id>dev</id>
                
          <activation>
                  
          <activeByDefault>false</activeByDefault>
                  
          <jdk>1.5</jdk>
                  
          <os>
                    
          <name>Windows XP</name>
                    
          <family>Windows</family>
                    
          <arch>x86</arch>
                    
          <version>5.1.2600</version>
                  
          </os>
                  
          <property>
                    
          <name>mavenVersion</name>
                    
          <value>2.0.5</value>
                  
          </property>
                  
          <file>
                    
          <exists>file2.properties</exists>
                    
          <missing>file1.properties</missing>
                  
          </file>
                
          </activation>
                
              
          </profile>
            
          </profiles>
          </project>

          3.當(dāng)使用屬性激活的時(shí)候
          <profiles>
                  
          <profile>
                      
          <id>test</id>
                      
          <activation>
                          
          <property>
                              
          <name>test.bingo</name>
                              
          <value>kkk</value>
                          
          </property>
                      
          </activation>
          </profile>
          </profiles>

          可以在命令行中mvn -Dtest.bingo=kkk或者mvn -Ptest這兩種方式激活該profile對(duì)pom設(shè)置的進(jìn)行覆蓋。

          4.當(dāng)使用變量替換的時(shí)候
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation
          ="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
              
              
          <build>
                  
          <resources>
                      
          <resource>
                        
          <directory>src/main/filter-resources</directory>
                        
          <filtering>true</filtering>
                      
          </resource>
                  
          </resources>

              
          </build>
              
          <profiles>
                  
          <profile>
                      
          <id>test</id>
                      
          <activation>
                          
          <property>
                              
          <name>test.bingo</name>
                              
          <value>kkk</value>
                          
          </property>
                      
          </activation>
                      
          <properties>
                          
          <env.dir>222</env.dir>
                      
          </properties>
                      
          <build>
                                  
          </profile>
              
          </profiles>
          </project>

          過(guò)濾指定的目錄下文件,如果該文件中有${env.dir}的變量,就會(huì)被222給覆蓋掉。

          posted on 2009-07-13 13:15 andy.kong 閱讀(1547) 評(píng)論(2)  編輯  收藏 所屬分類: maven

          評(píng)論

          # re: maven profile 2009-11-16 18:02 Shouling

          是bingo嗎?  回復(fù)  更多評(píng)論   

          # re: maven profile[未登錄] 2009-11-16 18:22 andy

          @Shouling
          這里的bingo只是一個(gè)字符串命名,沒有其他含義  回復(fù)  更多評(píng)論   


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          公告

          師者,所以傳道授業(yè)解惑也!

          導(dǎo)航

          <2009年11月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          統(tǒng)計(jì)

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 姚安县| 故城县| 武夷山市| 类乌齐县| 尉氏县| 新源县| 高青县| 原平市| 张家港市| 弥渡县| 堆龙德庆县| 通山县| 井研县| 基隆市| 西城区| 凤城市| 石家庄市| 旅游| 凯里市| 临湘市| 来安县| 灵丘县| 剑川县| 钟祥市| 顺平县| 安仁县| 绥中县| 上思县| 定兴县| 鹤峰县| 手游| 建德市| 崇左市| 杂多县| 辉县市| 南宁市| 游戏| 昭苏县| 榆中县| 花莲县| 康马县|