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

查看:78
本文介绍了如何使用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天全站免登陆