如何使用 maven 将输出 jar 放入另一个文件夹? [英] How to place the output jar into another folder with maven?

查看:24
本文介绍了如何使用 maven 将输出 jar 放入另一个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的输出 jar 和 jar-with-dependencies 放入另一个文件夹(不是在 target/ 中,而是在 ../libs/ 中).

I'd like to place my output jar and jar-with-dependencies into another folder (not in target/ but in ../libs/).

我该怎么做?

推荐答案

你可以使用 maven-jar-plugin 的 outputDirectory 参数来达到这个目的:

You can use the outputDirectory parameter of the maven-jar-plugin for this purpose:

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
          <outputDirectory>../libs</outputDirectory>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

但正如 cdegroot 所写的那样,您最好不要与专家作斗争.

But as cdegroot wrote, you should probably better not fight the maven way.

这篇关于如何使用 maven 将输出 jar 放入另一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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