使 Maven 将依赖项复制到 target/lib [英] Make Maven to copy dependencies into target/lib

查看:56
本文介绍了使 Maven 将依赖项复制到 target/lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将项目的运行时依赖项复制到 target/lib 文件夹中?

How do I get my project's runtime dependencies copied into the target/lib folder?

就像现在一样,在 mvn clean install 之后,target 文件夹只包含我项目的 jar,但不包含任何运行时依赖项.

As it is right now, after mvn clean install the target folder contains only my project's jar, but none of the runtime dependencies.

推荐答案

这对我有用:

<project>
  ...
  <profiles>
    <profile>
      <id>qa</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

这篇关于使 Maven 将依赖项复制到 target/lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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