删除maven中默认创建的jar [英] remove jar created by default in maven

查看:132
本文介绍了删除maven中默认创建的jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven程序集插件。在我的pom.xml中,pakaging类型:jar,我不使用maven jar插件。

I am using maven assembly plugin. in my pom.xml, pakaging type: jar and i dont use maven jar plugin.

每当我运行mvn clean包时,它会创建2个jar文件:一个来自maven程序集,另一个是默认创建的(由于打包类型= jar)。我只想保留由程序集插件创建的jar文件。怎么做?

Whenever i run mvn clean package, it create 2 jar files: one is from maven assembly, another one is created by default (due to packaging type =jar). I want to keep only the jar file created by assembly plugin only. How to do that?

推荐答案

你可能有你的理由,但我怀疑这是一个很好的解决方案,跳过默认的jar是构建和部署。

You may have your reasons but I doubt that it is a good solution to skip the default jar being built and deployed.

无论如何,这里是如何禁用正在构建的默认jar。

Anyhow here is how you can disable the default jar being built.

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <id>make-assembly</id>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!-- some configuration of yours... -->
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>default-jar</id>
                    <!-- put the default-jar in the none phase to skip it from being created -->
                    <phase>none</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

这篇关于删除maven中默认创建的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆