简体   繁体   English

mvn安装jar-with-dependencies

[英]mvn install jar-with-dependencies

有没有办法在使用maven-assembly-plugin创建的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: 如果将程序集绑定到打包阶段,则在执行构建时,它将在您的存储库中安装“常规”jar和with-dependencies jar:

        <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 assembly:assembly -DdescriptorId=jar-with-dependencies mvn assembly:assembly -DdescriptorId = jar-with-dependencies

:) :)

One way would be to create a project where you use the assembly-plugin. 一种方法是创建一个使用assembly-plugin的项目。 In the assembly-plugin configuration you can specify what output you want (jar, zip, ...) 在assembly-plugin配置中,您可以指定所需的输出(jar,zip,...)

In this projects pom you can put your dependencies and build it. 在这个项目中,你可以放置你的依赖项并构建它。 Every time you execute the install command all your dependencies will be in your packaged file. 每次执行install命令时,所有依赖项都将在打包文件中。

此处查看“执行:构建装配”标题下。

是不是mvn install不这样做?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM