maven 相关插件
2016-11-08 15:19
183 查看
maven打包配置,到底要打包哪些文件,如何配置??使用如下插件:
maven打包带依赖可执行的jar(注意需要指定main所在类), 执行 mvn clean assembly:assembly命令
执行:java -jar http-client-netty-1.0-SNAPSHOT-jar-with-dependencies.jar
spring-boot 打包JAR
java scala混合编译,加入scala编译插件
或者:
View Code
输出依赖jar到lib文件:
<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>
View Code
输出依赖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>
相关文章推荐
- Nexus搭建Maven私服(四) Maven 相关打包插件
- 5.Maven和Eclipse整合(两种方式进行插件的安装),Maven相关设置,Eclipse下创建Maven项目
- Maven 第一天:关于Maven的相关环境和插件问题
- sclipse maven相关插件检出项目使用
- 在Eclipse中使用Maven插件 博客分类: Java相关技术
- 在Eclipse中使用Maven插件 博客分类: Java相关技术
- Maven中测试插件(surefire)的相关配置及常用方法
- Maven中测试插件(surefire)的相关配置及常用方法
- maven打包相关插件总结(非web服务器运行环境)
- maven 学习笔记(二) maven及相关的eclipse插件安装
- maven 插件生成mybatis相关代码
- 5.Maven和Eclipse整合(两种方式进行插件的安装),Maven相关设置,Eclipse下创建Maven项目
- 各种主流SCM及maven相关插件
- maven-git-commit-id-plugin插件,jar包带上git commit相关信息
- Maven中测试插件(surefire)的相关配置及常用方法
- Ruby on Rails应用软件的相关Eclipse插件
- 相关工具类(utils)、包(package)、插件(plugins)介绍、使用
- Eclipse相关插件下载地址
- Firefox插件开发详解--需要掌握的技术和相关的开发网站
- Maven2插件surefire配置心得-1