maven-compiler-plugin

编译Java源码,一般只需设置编译的jdk版本

 
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
 

或者在properties设置jdk版本

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

maven-dependency-plugin

用于复制依赖的jar包到指定的文件夹里

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

maven-jar-plugin

打成jar时,设定manifest的参数,比如指定运行的Main class,还有依赖的jar包,加入classpath中

 
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>/data/lib</classpathPrefix>
<mainClass>com.zhang.spring.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
 

maven-antrun-plugin

在maven中运行Ant任务,比如在打包阶段,对文件进行复制

 
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target name="copy">
<delete>
<fileset dir="target" includes="*.properties"></fileset>
</delete>
<copy todir="target">
<fileset dir="files"></fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
 

wagon-maven-plugin

用于一键部署,把本地打包的jar文件,上传到远程服务器上,并执行服务器上的shell命令

 
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<serverId>crawler</serverId>
<fromDir>target</fromDir>
<includes>*.jar,*.properties,*.sh</includes>
<url>sftp://59.110.162.178/home/zhangxianhe</url>
<commands>
<command>chmod 755 /home/zhangxianhe/update.sh</command>
<command>/home/zhangxianhe/update.sh</command>
</commands>
<displayCommandOutputs>true</displayCommandOutputs>
</configuration>
</plugin>
 

tomcat7-maven-plugin

用于远程部署Java Web项目

 
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://59.110.162.178:8080/manager/text</url>
<username>linjinbin</username>
<password>linjinbin</password>
</configuration>
</plugin>
 

maven-shade-plugin

用于把多个jar包,打成1个jar包

一般Java项目都会依赖其他第三方jar包,最终打包时,希望把其他jar包包含在一个jar包里

 
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.meiyou.topword.App</Main-Class>
<X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
 

maven常用的plugin的更多相关文章

  1. 转:Maven常用命令

    转:Maven常用命令 Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1 ...

  2. maven常用插件pom配置

    一.问题描述: 部署一个maven打包项目时,jar包,依赖lib包全部手动上传至服务器,然后用maven部署报错:Exception in thread "main" java. ...

  3. Maven常用命令(转)

    Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1. 创建Maven的普通 ...

  4. Maven常用命令(转载)

    Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1. 创建Maven的普通 ...

  5. maven 常用命令及操作(转)

    Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1. 创建Maven的普通 ...

  6. Maven常用插件简单配置

    好久不见,甚是想念.一日不见,如隔三秋. 从春节到现在已经很久没有回归博客园了,今天回来温习一下maven常用的一些插件的配置,学东西一个很简单的诀窍就是重复重复再重复,这样一定能把知识掌握的很牢靠. ...

  7. maven 常用脚本

    Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1. 创建Maven的普通 ...

  8. maven常用命令介绍

    mvn 3.0.4 创建maven项目命令  mvn  archetype:generate   -DgroupId=damocles-autocredit -DartifactId=damocles ...

  9. Maven常用命令:

    Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ 一,Maven常用命令: 1. 创建Maven的 ...

随机推荐

  1. vue-router 2 跳转失败原因

    axios.post('/internal/user/login_from_mobile ',{ mobile: this.logPrefix+this.formInline1.mobile, pas ...

  2. Oracle:在 debian9 上完美安装 oracle 10.2.0.5 x64

    多余废话不说. 多动脑子,思路不要僵化. 关键点: --------------------------------------------------- 安装i386的支持库:libc6-dev:3 ...

  3. 解决计算机改名无法连接TFS的问题

    闲着没事改了下计算机名字,结果造成TFS无法连接. 报错讯息如下: ---------------------------Microsoft Visual Studio---------------- ...

  4. Java位运算加密

    创建一个类,通过位运算中的”^"异或运算符把字符串与一个指定的值进行异或运算,从而改变字符串每个字符的值,这样就可以得到一个加密后的字符串.当把加密后的字符串作为程序输入内容,再与那个指定的 ...

  5. SpringMVC -- 梗概--源码--贰--拦截器:Interceptor

    附:实体类 1.配置web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app versi ...

  6. 6.824 Lab 5: Caching Extents

    Introduction In this lab you will modify YFS to cache extents, reducing the load on the extent serve ...

  7. 联想一体机u盘启动设置

    开机启动按f12键,进入后,到最后一项exit把OS Optimized Defaults(操作系统优化的缺省值)改成Disabled(关闭). 再进入到Startup这一项,选择UEFI/Legac ...

  8. css counter的使用方法

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. iOS iTuns Connect官方配置教程

    iTunes Connect 开发者指南 (iTunes Connect Developer Guide): https://developer.apple.com/library/ios/docum ...

  10. MySQL实现树状所有子节点查询的方法

    本文实例讲述了MySQL实现树状所有子节点查询的方法.分享给大家供大家参考,具体如下: 在Oracle 中我们知道有一个 Hierarchical Queries 通过CONNECT BY 我们可以方 ...