2012-09-19 51 views
0

我得等,其中對父母的定義POM模塊,如多模塊項目:的Maven插件發佈行家2

<modules> 
    <module>child1</module> 
    <module>child2</module> 
</modules> 

當我在父項目mvn release:prepare類型,建立每一個孩子,和本身的結束。有沒有辦法告訴發佈插件安裝每個孩子?所以,當我輸入mvn release:prepare它對孩子:建立安裝,並在最終版本?

父POM:

<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"> 
<modelVersion>4.0.0</modelVersion> 

<groupId>com.voncuver</groupId> 
<artifactId>cu</artifactId> 
<packaging>pom</packaging> 
<version>1.6.1-SNAPSHOT</version> 

<properties> 
    <spring-version>2.5.6</spring-version> 
    <maven-plugin-version>4.1.0.1-fuse</maven-plugin-version> 
</properties> 

<scm> 
    <connection>scm:svn:file:///C:/Users/voncuver/Documents/myRepository/cu</connection> 
    <developerConnection>scm:svn:file:///C:/Users/voncuver/Documents/myRepository/cu</developerConnection> 
</scm> 

<modules> 
    <module>cu-pars-engine</module> 
    <module>cu-agent</module> 
</modules> 


<build> 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <executions> 
       <execution> 
        <configuration> 
         <classifier>${target.env}</classifier> 
        </configuration> 
       </execution> 
      </executions> 
      <configuration> 
       <archive> 
        <manifest> 
         <addDefaultImplementationEntries>true</addDefaultImplementationEntries> 
        </manifest> 
        <manifestEntries> 
         <Build>${JOB_NAME} #${BUILD_NUMBER} at ${BUILD_ID}</Build> 
         <Environment>${environment.type}</Environment> 
         <Revision>${SVN_REVISION}</Revision> 
        </manifestEntries> 
       </archive> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-eclipse-plugin</artifactId> 
      <version>2.8</version> 
     </plugin> 
    </plugins> 
</build> 

<repositories> 
    <repository> 
     <id>releases</id> 
     <url> 
      http://maven.vonc.com/content/repositories/releases/ 
     </url> 
     <releases> 
      <enabled>true</enabled> 
     </releases> 
     <snapshots> 
      <enabled>false</enabled> 
     </snapshots> 
    </repository> 
    <repository> 
     <id>snapshots</id> 
     <url> 
      http://maven.von.com/content/repositories/snapshots/ 
     </url> 
     <releases> 
      <enabled>false</enabled> 
     </releases> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
    </repository> 
</repositories> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <artifactId>cu-pars-engine</artifactId> 
      <groupId>com.voncuver</groupId> 
      <version>${pom.version}</version> 
     </dependency> 
     <dependency> 
      <artifactId>cu-agent</artifactId> 
      <groupId>com.voncuver</groupId> 
      <version>${pom.version}</version> 
     </dependency> 
</dependencyManagement> 

<distributionManagement> 
    <repository> 
     <id>releases</id> 
     <url>http://maven.von.com/content/repositories/releases</url> 
     <layout>default</layout> 
    </repository> 
    <snapshotRepository> 
     <id>snapshots</id> 
     <url>http://maven.von.com/content/repositories/snapshots</url> 
     <layout>default</layout> 
     <uniqueVersion>true</uniqueVersion> 
    </snapshotRepository> 
</distributionManagement> 

兒童:

<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"> 

<modelVersion>4.0.0</modelVersion> 

<parent> 
    <artifactId>cu</artifactId> 
    <groupId>com.voncuver</groupId> 
    <version>1.6.1-SNAPSHOT</version> 
</parent> 

<artifactId>cu-pars-engine</artifactId> 
<packaging>jar</packaging> 


<dependencies> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.15</version> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>javacc-maven-plugin</artifactId> 
      <version>2.5</version> 
      <executions> 
       <execution> 
        <id>javacc</id> 
        <goals> 
         <goal>javacc</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>javacc-ptparser</id> 
        <goals> 
         <goal>jjtree-javacc</goal> 
        </goals> 
        <configuration> 
         <isStatic>false</isStatic> 
         <buildNodeFiles>true</buildNodeFiles> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

兒童第二:

<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"> 
<parent> 
    <artifactId>cu</artifactId> 
    <groupId>com.voncuver</groupId> 
    <version>1.6.1-SNAPSHOT</version> 
</parent> 
<modelVersion>4.0.0</modelVersion> 

<artifactId>cu-agent</artifactId> 
<packaging>jbi-service-unit</packaging> 

<dependencies> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.12</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

+0

你在孩子2中定義了什麼樣的包裝(確實存在一個合適的maven插件?)。啊發現它(http://camel.apache.org/jbi.html)。 – khmarbaise

+0

你的項目的文件夾結構如何? – khmarbaise

+0

你可以在mvn發佈期間發佈完整的錯誤輸出:準備? – khmarbaise

回答

0

如果你有一個多模塊構建你需要做的MVN發佈:準備和MVN發佈:您多模塊構建的根,而不是每一個孩子執行步驟。

+0

是的,這是正確的,但在我這樣做的情況下,mvn發佈:準備結束失敗,因爲父項目希望發佈版本的孩子。女巫不在本地回購或遠程回購。當你執行mvn release:prepar時,mvn會構建每個項目(父,子),但不會安裝它。所以當父母或孩子的項目依賴於另一個孩子時,它找不到它。執行mvn發行版時,我的解決方案是額外的目標:準備。 [鏈接](http://maven.apache.org/plugins/maven-release-plugin/examples/run-goals-before-commit.html) – voncuver

+0

這聽起來你的項目配置不正確。你能展示你的根源,也許是你的孩子的一些摘錄? – khmarbaise

+0

我已附加到主帖子。謝謝。 – voncuver