2013-03-25 42 views
0

我在父母的pom.xml和孩子pom.xml中定義的配置文件,但是當我嘗試從父項目mvn install -P profile name,在配置文件中定義的屬性不被複制Maven POM文件親子檔案問題

我父pom.xml的樣子:

  <dependencies> 
       <dependency> 
       <groupId>xxx</groupId> 
       <artifactId>xxx</artifactId> 
       <version>0.0.1-SNAPSHOT</version> 
       <type>pom</type> 
      </dependency> 
      </dependencies> 

      <plugin> 
      <artifactId>maven-resources-plugin</artifactId> 
      <executions> 
      <execution> 
      <id>copy-resources</id> 
      <phase>verify</phase> 
       <goals> 
       <goal>copy-resources</goal> 
       </goals> 
      <configuration> 
       <outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>        <resources> 
      <resource> 
      <directory>deployment/${environment}</directory> 
      </resource> 
      </resources> 
      </configuration> 
      </execution> 
      </plugin> 

我的孩子的pom.xml:

 <plugin> 
     <artifactId>maven-resources-plugin</artifactId> 
     <executions> 
     <execution> 
     <id>copy-resources</id> 
     <phase>verify</phase> 
      <goals> 
      <goal>copy-resources</goal> 
      </goals> 

     </execution> 
     </plugin> 

回答

1

你需要從孩子是指你的父母:

<parent> 
    <groupId>org.company.groupid</groupId> 
    <!-- Artifact id of the parent here --> 
    <artifactId>parentArtifactId</artifactId> 
    <!-- Version of the parent here --> 
    <version>1.0-SNAPSHOT</version> 
</parent> 
+0

from child pom.xml我正在嘗試構建一個jar文件,我已經在子項目pom.xml中定義了配置文件maven-resorces-plugin,但是當我在子項目上執行mvn -P profilename時,my childproject.jar META-INF /屬性文件沒有我正在運行的配置文件值,我做了什麼錯誤 – user665837 2013-03-25 10:41:45