本文介绍了mvn安装jar-with-dependencies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在使用maven-assembly-plugin创建的具有依赖关系的jar上进行安装?

Is there a way to do an install on a jar-with-dependencies created using maven-assembly-plugin?

推荐答案

如果将程序集绑定到打包阶段,则在进行构建时它将在您的存储库中同时安装常规" jar和with-dependencies jar. :

If you bind the assembly to the packaging phase, it will install in your repository both the "regular" jar and the with-dependencies jar when you do a build:

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> <!-- this is used for inheritance merges -->
                    <phase>package</phase> <!--  bind to the packaging phase -->
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

这篇关于mvn安装jar-with-dependencies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 11:05