如何在同一个maven项目中做2个拉链?

时间:2016-03-09 08:38:05

标签: maven

我有一个只做zip文件的简单项目。 但我想在同一个maven项目中制作2个拉链。

pom.xml:

  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration> 
            <descriptor>src/assembly/zip.xml</descriptor>
                <finalName>name</finalName>     
            </configuration>                
        </plugin>
    </plugins>  
</build>

和zip.xml:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<formats>
    <format>zip</format>
    <format>tar</format>
    <format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
    <fileSet>
        <directory>..\Maven_EclipseSite\target\products\.package\${prop.os32}\${prop.ws32}\${prop.arch32}</directory>
        <outputDirectory>${prop.arch32}</outputDirectory>
    </fileSet>
</fileSets>

构建后我有1个zip,1个tar和1个tar.gz. 但我希望复制3有2个zip,2个tar和2个tar.gz,一个32位,一个64位。

我尝试在pom中添加另一个插件

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptor>src/assembly/zip1.xml</descriptor>
                <finalName>name32bits</finalName>                   
            </configuration>                
        </plugin>
                    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptor>src/assembly/zip2.xml</descriptor>
                <finalName>name64bits</finalName>                   
            </configuration>                
        </plugin>

    </plugins>  
</build>

但只有最后一个生成.. 我该怎么办?

谢谢你! :)

- 我尝试添加执行: mvn程序集:assemby导致错误:  无法执行目标org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:项目上的程序集(default-cli)Maven_Installer:读取程序集时出错:找不到程序集描述符。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>zip32</id>
                    <phase>assembly</phase>
                    <configuration>
                        <descriptor>src/assembly/zip32.xml</descriptor>
                        <finalName>SystemWorkbench${prop.os32}${prop.arch32}</finalName>                    
                    </configuration>
                    <goals>
                      <goal>assembly</goal>
                    </goals>
                </execution>
                <execution>
                    <id>zip64</id>
                    <phase>assembly</phase>                     
                    <configuration>
                        <descriptor>src/assembly/zip64.xml</descriptor>
                        <finalName>SystemWorkbench${prop.os32}${prop.arch64}</finalName>                    
                    </configuration>
                    <goals>
                      <goal>assembly</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>  
</build>

0 个答案:

没有答案