Java-Maven(十):Maven 项目常用plugins
本文主要总结最近一段时间使用maven时,遇到需要maven plugins的一些简单总结。
1)在Build下重新指定最终打包报名
<build>
<!--最终打包的包名,如果这里不指定,则默认包名为:artifactId-version.jar(com-test-project-1.0-SNAPSHOT.jar)-->
<finalName>The-Test-Pro</finalName>
...
</build>
2)Maven Repository上以外的自定义包引入,以及如何设置才能被打包进来
a)在dependencies下引入lib下的jar
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11-1.5.2.logging</artifactId>
<version>2.11</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/spark-core_2.11-1.5.2.logging-2.11.jar</systemPath>
</dependency>
b)在maven-compiler-plugin配置包时将/lib下的包打包进来
<!--代码编译,指定扩展包在lib下,且打包时将/lib下的包打包进来-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<compilerArguments>
<extdirs>${project.basedir}/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
3)通过maven-assembly-plugin设置编译fat包
<!--
在pom中配置了若干依赖,需要将pom中所有的依赖全部打包进一个jar包中,可以选择的方案有maven-assembly-plugin
此时,在Target下会打包一个finalName-jar-with-dependencies.jar,(不指定finalName时:artifactId-version-with-dependencies.jar)
-->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.main.Invoker</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
4)使用maven-dependency-plugin拷贝依赖的jar包到/target/lib目录
<!-- 拷贝依赖的jar包到/target/lib目录 -->
<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>
Java-Maven(十):Maven 项目常用plugins的更多相关文章
- 03.基于IDEA+Spring+Maven搭建测试项目--常用dependency
<!--常用的依赖配置--> <!--未展示完整的pom.xml文件内容--> <properties> <java.version>1.8</j ...
- java十五个常用类学习及方法举例
<code class="language-java">import java.util.Scanner; import java.util.Properties; i ...
- java进阶之-Maven,svn,git,maven合拼多个项目
git的使用介绍(写很容易懂得哦) maven合拼多个项目(写得很好哦) MAVEN作用:统一开发规范与工具:统一管理jar包 1.下载MAVEN 下载绿色版的面安装 2.环境配置 eclipse想 ...
- 【项目管理和构建】十分钟教程,eclipse配置maven + 创建maven项目(三)
[项目管理和构建]十分钟教程,eclipse配置maven + 创建maven项目(三) 上篇博文中我们介绍了maven下载.安装和配置(二),这篇博文我们配置一下eclipse,将它和maven结合 ...
- JAVA Eclipse使用Maven构建web项目详解(SSM框架)
tips: 启动项目后,welcome-file的链接即为测试用例 部署maven web项目 Eclipse使用Maven构建web项目详解 pom.xml添加webapp依赖: <depen ...
- IDEA用maven创建springMVC项目和配置(XML配置和Java配置)
1.DEA创建项目 新建一个maven project,并且选择webapp原型. 然后点击next 这里的GroupId和ArtifactID随意填写,但是ArtifactID最好和你的项目一名一样 ...
- 第三章 Maven构建 Java Spring Boot Web项目
3.1 认识Srping Boot Spring Boot是一个框架,是一种全新的编程规范,它的产生简化了对框架的使用,简化了Spring众多的框架中大量的繁琐的配置文件,所以说Spring Bo ...
- springBoot项目常用maven依赖以及依赖说明
springBoot项目常用maven依赖以及依赖说明 1:maven-compiler-plugin <build> <plugins> <!-- 指定maven编译的 ...
- maven新建web项目提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
maven新建web项目提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Bu ...
随机推荐
- 删除Ubuntu的UEFI启动项
bcdedit 删除 千万不要手贱用diskpart之类的命令直接删除文件夹,大写的没,有,用! 感谢这个视频的up主,youtube看不到请翻墙.https://www.youtube.com/wa ...
- array_reduce() 与 array_map()
相似部分: 二者同为 处理数组函数,可遍历 数组中的每一个元素, 对其通过 function callback(){} 处理. 不同处: 参数: array_reduce( array, callba ...
- Python——Python安装
下载地址:https://www.python.org/downloads/windows/ 3.X安装方法: 1. 设置一个自选路径,并将下面的选项打钩.(建议使用根目录) 2. 应用在所有用户中 ...
- Linux磁盘管理——directory tree与mount point
参考:/sys 和 /dev 区别 Linux磁盘管理——虚拟文件系统 Directory tree Linux内的所有数据都是以文件的形态来呈现的,所以整个Linux系统最重要的地方就是direct ...
- Linux命令——readlink、realpath
参考:Linux命令——ln Linux readlink and realpath Command Tutorial for Beginners (with Examples) 简介 ln命令允许你 ...
- 使用Cloudera Manager搭建HDFS完全分布式集群
使用Cloudera Manager搭建HDFS完全分布式集群 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 关于Cloudera Manager的搭建我这里就不再赘述了,可以参考 ...
- 隐藏按钮button
<td> <input id="del" type="button" value="删除" onclick="u ...
- jenkins+ant+jmeter接口自动化的持续集成
一.jmeter.jenkins安装 这里不再说明,请看上一个随笔!!! 链接:https://www.cnblogs.com/magicYJ/p/11839646.html 二.ant安装 下载地址 ...
- spark HMM
Scala实现的: https://github.com/skrusche63/spark-intent/tree/master/src/main/scala/de/kp/scala/hmm http ...
- CF1167E. Range Deleting
题意 给定长度为\(n\)的数组\(a\),其中任意\(a_i \leq x\) 定义\(f(l,r)\)为删除\(a\)中值域在\([l,r]\)的数后剩余的数组. 统计满足\(1\leq l \l ...