Maven Assembly PlugIn with Shade用于生产一个罐子

时间:2013-11-20 13:50:40

标签: maven jar apache-poi maven-assembly-plugin maven-shade-plugin

我有这个问题, 这是我的POM构建部分

<build>
    <plugins>
        <plugin>
             <artifactId>maven-assembly-plugin</artifactId>
             <configuration>
              <descriptors>
               <descriptor>bin.xml</descriptor>
              </descriptors>
             </configuration>
             <executions>
              <execution>
               <id>dist</id>
               <phase>package</phase>
               <goals>
                <goal>single</goal>
               </goals>
              </execution>
             </executions>
        </plugin>
        <!-- SHADE PLUGIN -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.1</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                      <mainClass>document.readingXLS.GUIReader</mainClass>
                    </transformer>
                  </transformers>
                </configuration>
              </execution>
            </executions>
          </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
        </plugin>
        <!-- START per maven 3.0 -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.4</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0</version>
            <dependencies>
                <dependency><!-- add support for ssh/scp -->
                    <groupId>org.apache.maven.wagon</groupId>
                    <artifactId>wagon-ssh</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

我生成包含依赖项的1个JAR。 但是当我生成带有Assembly的ZIP文件到zip中时。我有2个JAR(MyProject和POI)

这是我的装配部分:

<assembly>
    <id>dist</id>
    <formats>
        <format>zip</format> 
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>/LibGenerator</outputDirectory>
            <includes>
                <include>Vas:Generator:jar</include>
                <include>org.apache.poi:poi:jar</include>
            </includes>
        </dependencySet>                        
    </dependencySets>

</assembly>

我如何配置它以使用Assembly plugIn生成1个JAR? 非常感谢。

0 个答案:

没有答案