maven 常用插件 拷贝依赖 拷贝jar包 查看属性 环境变量
1 maven编译后希望将生产的jar包拷贝到指定目录
在pom中配置maven插件
maven-antrun-plugin
<build >
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-lib-src-webapps</id>
<phase>package</phase>
<configuration>
<tasks>
<!-- <delete dir="src/main/webapp/WEB-INFb" />-->
<copy todir="F:\jar\libs">
<fileset dir="${env.ACCOUNTINGDOCUMENT_JAVA_PATH}\fi-gl-accountingdocument-core\target">
<include name="fi-gl-accountingdocument-core-1.0-SNAPSHOT.jar" />
</fileset>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2 希望使用内置属性 ${properties.property} 方便项目协作
但不清楚有哪些properties 没找到简单的查看properties的方法
增加配置节点 执行validate 控制台会打印具体的properties
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echoproperties />
</tasks>
</configuration>
</execution>
如 想将生成的jar包拷贝到F:\jar\libs
<build >
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-lib-src-webapps</id>
<phase>package</phase>
<configuration>
<tasks>
<!-- <delete dir="src/main/webapp/WEB-INFb" />-->
<copy todir="F:\jar\libs">
<fileset dir="${project.build.directory}">
<include name="${project.artifactId}-${project.version}.jar" />
</fileset>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<!-- <execution>-->
<!-- <phase>validate</phase>-->
<!-- <goals>-->
<!-- <goal>run</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <tasks>-->
<!-- <echoproperties />-->
<!-- </tasks>-->
<!-- </configuration>-->
<!-- </execution>-->
</executions>
</plugin> </plugins> </build>
3 拷贝依赖到制定文件夹
includeGroupIds过滤拷贝的groupid
<properties>
<project.targetDir>D:\jar</project.targetDir>
<project.targetServerDir>\\localhost\c$\jar</project.targetServerDir>
</properties>
<build>
<plugins> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.inspur.gs</includeGroupIds>
<outputDirectory>${project.targetDir}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
参考:
1 https://stackoverflow.com/questions/12317609/maven-overview-for-the-values-of-maven-properties
2 https://books.sonatype.com/mvnref-book/reference/resource-filtering-sect-properties.html
3 http://www.avajava.com/tutorials/lessons/how-do-i-display-the-value-of-a-property.html
maven 常用插件 拷贝依赖 拷贝jar包 查看属性 环境变量的更多相关文章
- maven 打包含有第三方依赖的 jar 包
maven 打包含有第三方依赖的 jar 包:mvn assembly:assembly
- 【Maven】从Maven中导出项目依赖的Jar包
从SVN上下载源代码 svn export https://10.200.1.201/xxxx/PLATFORM code/ --force --username xxx --password xxx ...
- maven buid 导出项目依赖的jar包问题
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencie ...
- Eclipse里面的Maven项目如果下载依赖的jar包的源码
Window---------Properties---------------Maven--------------勾选Download Artifact Sources和Download Arti ...
- maven 导出项目所依赖的jar包
1.在 pom文件中 点击 Run As->Maven Build 2.在 Goals 中输入 dependency:copy-dependencies 3.之后会在 项目目录的 target/ ...
- maven项目中 把依赖的jar包一起打包
1.pom.xml 配置文件: 在pom.xml配置文件中添加 <build> <plugins> <plugin> <artifactId>maven ...
- maven工程打包成runnable的jar包,拷贝资源和依赖jar包
eclipse下新建maven工程,生成runnable的jar包.之前一直是手动拷贝依赖的jar包和资源文件,烦得要死.上网可劲查了一下.解决方案如下. 在pom的配置文件中做如下配置: <b ...
- 使用 Maven 插件将 class(字节码文件),resource(资源文件),lib(依赖的jar包)分开打包
1. 在pom文件中对各个插件进行配置 <?xml version="1.0" encoding="UTF-8"?> <project xml ...
- maven中把依赖的JAR包一起打包(转)
转自:http://lvjun106.iteye.com/blog/1849803 这里所用到的MAVEN-PLUGIN是MAVNE-ASSEMBLY-PLUGIN 官方网站是:http://mave ...
随机推荐
- UE4 质心相关
Add force 始终给质心施加力,即使手动偏移了质心(Center of mass)也不例外. Add force at location local 相对于物体的原始质心位置增加一个偏移值后的位 ...
- 版本基线自动化之Linux
上一篇笔者叙述了如何在windows平台上进行自动化打包,这次采用linux平台 1.start.bat : 调用cleanall.bat脚本 ,从svn服务器中检出代码,并采用7-Zip工具进行压缩 ...
- 170905-MyBatis中的关系映射
===关系映射=== 参考文档复习:1对1,1对多,多对多 1.映射(多)对一.(一)对一的关联关系 1).使用列的别名 ①.若不关联数据表,则可以得到关联对象的id属性 ②.若还希望得到关联对象的其 ...
- session.flush()与session.clear()的区别
session.flush()和session.clear()就针对session的一级缓存的处理. 简单的说, 1 session.flush()的作用就是将session的缓存中的数据与数据库同步 ...
- ios8来了,屏幕更大,准备好使用 iOS Auto Layout了吗?
引言: Auto Layout是iOS6发布后引入的一个全新的布局特性,其目的是弥补以往autoresizing在布局方面的不足之处,以及未来面对更多尺寸适配时界面布局可以更好的适应. 要完全掌握Au ...
- MVP 实战
那么我们下面就要将这个类中的代码改写为 MVP 的写法,回顾上面提及的 MVP 架构的思想,它是将 View 层与 Model 层彻底隔离,意味着 View 和 Model 都不再持对方的引用,它们通 ...
- Matlab 读取文件夹里所有的文件
(image = dir('D:\gesture\*.*'); % dir是指定文件夹得位置,他与dos下的dir用法相同. 用法有三种: 1. dir 是指工作在当前文件夹里 2. dir name ...
- CAS-4.2.7接入REST登录认证,移动端、C/S端登录解决方案
一.发送GET请求获取RSA公钥和JSESSIONID 请求地址:/cas/login,请求类型:GET curl -I http://cas.gfstack.geo:8080/cas/login 返 ...
- (转)websphere内存溢出,手动导出was的phd和javacore文件
原文:https://www.cnblogs.com/zhengbn/p/3499700.html 1:服务器-->服务器类型-->WebSphere Application Server ...
- SpringBoot 集成mongodb(1)单数据源配置
新项目要用到mongodb,于是在个人电脑上的虚拟环境linux上安装了下mongodb,练习熟悉下. 1.虚拟机上启动mongodb. 首先查看虚拟机ip地址,忘了哈~~ 命令行>ifconf ...