Maven的 - 一些依赖JAR文件复制到warSourceDirectory [英] Maven - Copy Some Dependency JARs into warSourceDirectory

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

问题描述

任何Maven插件可以复制一个或多个依赖(虽然不是全部)一的.war 项目纳入其 warSourceDirectory 的src /主/ web应用)?

Can any Maven plugins copy one or more dependencies (although not all of them) of a .war project into its warSourceDirectory (src/main/webapp)?

我工作的一个Java Web应用程序,将显示一个小程序。我想战争项目中选择最新版本的一些罐子(applet的相关性),并把它们粘 / src目录/主/ web应用/ ,为了救我不得不复制它们周围的地方。

I'm working on a Java web-app that will display an applet. I'd like the war project to pick the latest version of some jars (the applet's dependencies) and stick them in /src/main/webapp/, to save me having to copy them around the place.

我想过阴影和尤伯杯JAR-ING的小应用程序本身,但我想分裂的罐子以保存用户不必下载一个巨大的罐子时,只有在其位的一个改变。

I've thought about shading and uber-jar-ing the applet itself, but I'd like to split the jars up to save users having to download one massive jar when only one of the bits in it has changed.

推荐答案

使用这个的相关性:从的Maven Dependency插件复制 。

Use for this dependency:copy from Maven Dependency Plugin.

阅读也示例页面:复制特定的文物

示例配置

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
    <execution>
        <id>copy</id>
        <phase>compile</phase>
        <goals>
            <goal>copy</goal>
        </goals>
        <configuration>
            <artifactItems>
                <artifactItem>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>3.8.1</version>
                    <type>jar</type>
                    <overWrite>false</overWrite>
                    <destFileName>optional-new-name.jar</destFileName>
                </artifactItem>
            </artifactItems>
            <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/</outputDirectory>
            <overWriteReleases>false</overWriteReleases>
            <overWriteSnapshots>true</overWriteSnapshots>
        </configuration>
    </execution>
</executions>

将文件复制到的src /主/ web应用是坏主意。复制文件直接插入目标文件夹中。

Copying files into src/main/webapp is bad idea. Copy file directly into target folder.

这篇关于Maven的 - 一些依赖JAR文件复制到warSourceDirectory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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