maven打包配置,到底要打包哪些文件,如何配置??使用如下插件:

    <build>
<finalName>weatherAdminSys</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webXml>web\WEB-INF\web.xml</webXml>
<webResources>
<resource>  <!-- 重点看 -->
<directory>
web/
</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

maven打包带依赖可执行的jar(注意需要指定main所在类), 执行 mvn clean assembly:assembly命令

执行:java -jar http-client-netty-1.0-SNAPSHOT-jar-with-dependencies.jar

    <plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.pt.utils.HttpClientUtil</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>

spring-boot 打包JAR

<!--打包成可执行的jar-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--高版本要求JDK8-->
<version>1.3.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

java scala混合编译,加入scala编译插件

    <plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

或者:

<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
<useFsc>true</useFsc>
<once>true</once>
</configuration>
</plugin>

输出依赖jar到lib文件:

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

最新文章

  1. Android中的flexboxlayout布局
  2. ubuntu 16.04 安装nodejs
  3. iOS开发之Core Animation
  4. 《深入理解Spark:核心思想与源码分析》(第2章)
  5. 如何在CentOS 7上安装Percona服务器
  6. 在命令行中通过adb shell am broadcast发送广播通知
  7. paip.语义分析--单字词名词表
  8. paip.Java Annotation注解的作用and 使用
  9. struts2的标签中得到JSP脚本的变量值
  10. Linux 64位编译\链接32位程序
  11. FlushMode属性与transaction(spring注入的事务)
  12. Android为应用在桌面添加一个快捷方式
  13. 【HDOJ】1726 God’s cutter
  14. Mysql 视图笔记2
  15. Python基础篇-day8
  16. Oracle外键需要建索引吗?
  17. Python3玩转儿 机器学习(3)
  18. FFmpeg部署及相关指令操作说明
  19. phpstorm 实现SFTP开发,线上线下同步(实时更新代码)
  20. Javascript高级编程学习笔记(28)—— BOM(2)window对象2

热门文章

  1. mac权限
  2. Debian 升级到 PHP 7,并支持并行安装
  3. 在Vue中使用layer.js弹出层插件
  4. 你不知道的Google Search
  5. nginx的proxy_pass到$host的问题
  6. X264使用指南
  7. MapReduce Input Split(输入分/切片)具体解释
  8. 使用google的GSON解析json格式的数据
  9. java高级主题
  10. iOS 开发之RunLoop