码迷,mamicode.com
首页 > 编程语言 > 详细

Maven中将所有依赖的jar包全部导出到文件夹

时间:2016-12-03 21:19:04      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:ati   targe   pom.xml   文献   artifact   config   style   解决方案   not   

因为我要对Java类的功能在生产环境(服务器端)进行测试,所以需要将jar包导出,然后在服务器端用-Djava.ext.dirs=./lib的方式走一遍,

下面是解决方案:

在pom.xml中加入如下代码:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

即可在target/目录下生成lib文件夹,里面就是全数的jar包啦~

 

参考文献:

maven中maven-assembly-plugin的使用

Maven中将所有依赖的jar包全部导出到文件夹

标签:ati   targe   pom.xml   文献   artifact   config   style   解决方案   not   

原文地址:http://www.cnblogs.com/zklidd/p/6129410.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!