Maven分模块项目将依赖一起打包
2017-03-24 10:43
489 查看
这里记录一下几种方式 以后备用:
1.maven-assembly-plugin插件(mvn assembly:assembly)
2.maven-shade-plugin插件
3.scala-maven-plugin插件(scala的打包插件)
1.maven-assembly-plugin插件(mvn assembly:assembly)
2.maven-shade-plugin插件
3.scala-maven-plugin插件(scala的打包插件)
<plugins> <build> <sourceDirectory>src/main/scala</sourceDirectory> <testSourceDirectory>src/test/scala</testSourceDirectory> <plugins> //scala-maven-plugin的打包插件配置 <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.2.2</version> <executions> <execution> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> <configuration> <args> <arg>-make:transitive</arg> <arg>-dependencyfile</arg> <arg>${project.build.directory}/.scala_dependencies</arg> </args> </configuration> </execution> </executions> </plugin> //maven-shade-plugin的打包插件配置 <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> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>reference.conf</resource> </transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>cn.touna.main.BootStrop</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> //maven-assembly-plugin的打包方式 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.5.5</version> <configuration> <archive> <manifest> <mainClass>cn.touna.main.BootStrop</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins>
相关文章推荐
- eclipse maven项目导出jar包时一起打包所依赖的相关jar包
- maven项目中 把依赖的jar包一起打包
- maven(android-maven-plugin3.8.0)打包apk无法启动,apklib依赖包的资源索引出错(R文件与主模块冲突)问题解析
- Maven中如何配置WAR依赖WAR和JAR的多模块项目结构
- Maven项目发布到servlet容器,没有把Maven依赖包一起发布的问题
- maven中把依赖的JAR包一起打包
- maven项目依赖无法关联打包的问题
- Maven多模块项目依赖管理
- maven项目打包为含依赖的可执行jar
- eclipse打maven的jar包连依赖jar一起打包方法
- Maven自动生成可运行jar包并将依赖的jar包一起打包
- maven中把依赖的JAR包一起打包
- Spring-boot web 工程构建,并把maven子项目模块依赖jar打包,笔记
- 使用tomcatPlugin配合JRebel解决maven项目依赖war的打包和热部署的问题
- 个人自制maven快速入门及其管理web项目多模块的依赖图文并茂教程
- Maven将有依赖其它jar包的项目打包成jar包(路径依赖),一步到位。
- maven中把依赖的JAR包一起打包
- maven中把依赖的JAR包一起打包
- Maven项目中War包的打包及依赖方式
- Maven项目中War包的打包及依赖方式