首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在maven- jar -plugin中使用jar:jar目标构建多个jar文件

如何在maven- jar -plugin中使用jar:jar目标构建多个jar文件
EN

Stack Overflow用户
提问于 2013-10-16 22:07:27
回答 1查看 2.3K关注 0票数 1

我们的pom.xml在maven- jar插件中有多个执行,目的是创建三个单独的jar文件。调用mvn并构建这三个jars的方法是什么?

目前

代码语言:javascript
复制
mvn compile jar:jar

仍然只创建一个罐子。

代码语言:javascript
复制
    <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.2</version>
    <executions>
        <execution>
            <id>UDFCommon</id>
            <goals><goal>jar</goal></goals>
            <phase>package</phase>
            <configuration>
                <forceCreation>true</forceCreation>
                <classifier>UDFCommon</classifier>
                <includes>
                    <include>**/pafcommon/*</include>
                </includes>
            </configuration>
        </execution>
        <execution>
            <id>UDFOne</id>
            <goals><goal>jar</goal></goals>
            <phase>package</phase>
            <configuration>
                <classifier>UDFOne</classifier>
                <includes>
                    <include>**/dqm/*</include>
                </includes>
            </configuration>
        </execution>
        <execution>
            <id>UDFTwo</id>
            <goals><goal>jar</goal></goals>
            <phase>package</phase>
            <configuration>
                <classifier>UDFTwo</classifier>
                <includes>
                    <include>**/ciview/*</include>
                </includes>
            </configuration>
        </execution>
    </executions>
    </plugin>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-16 22:27:12

jar:jar似乎不处理多个jar文件。但跑

代码语言:javascript
复制
mvn compile package

就能做到这一点。

代码语言:javascript
复制
-rw-r--r--   1 steve  staff  2629074 Oct 16 15:24 UDFPafDqm.jar
-rw-r--r--   1 steve  staff    13286 Oct 16 15:24 UDFPafDqm-UDFTwo.jar
-rw-r--r--   1 steve  staff    40315 Oct 16 15:24 UDFPafDqm-UDFOne.jar
-rw-r--r--   1 steve  staff     6942 Oct 16 15:24 UDFPafDqm-UDFCommon.jar

这需要一个assembly.xml :下面是一个基本的骨架。

代码语言:javascript
复制
<assembly>
    <id>job</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>${project.build.outputDirectory}</directory>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>


    <dependencySets>
        <dependencySet>
            <scope>runtime</scope>
            <outputDirectory>lib</outputDirectory>
        </dependencySet>
    </dependencySets>
</assembly>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19414802

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档