maven-assembly-plugin 打包简单案例
- <dependencies>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.1.9.Final</version>
- </dependency>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>1.16.18</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <encoding>UTF-8</encoding>
- <compilerArguments>
- <extdirs>lib/</extdirs>
- </compilerArguments>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifest>
- <mainClass>com.dalong.netty.MyMain</mainClass>
- </manifest>
- </archive>
- <!--<descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>-->
- <descriptors><!--描述文件路径-->
- <descriptor>src/main/assembly/assembly.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- <classpathPrefix>lib/</classpathPrefix>
- <mainClass>com.dalong.netty.MyMain</mainClass>
- </manifest>
- </archive>
- <excludes>
- <exclude>**/*.conf</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- <excludeScope>provided</excludeScope>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok-maven-plugin</artifactId>
- <version>1.16.18.0</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>delombok</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <assembly
- xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>mydemo</id>
- <includeBaseDirectory>true</includeBaseDirectory>
- <formats>
- <format>zip</format>
- </formats>
- <fileSets>
- <fileSet>
- <directory>${project.basedir}\src\main\resources</directory>
- <outputDirectory>conf/</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>${project.basedir}\target\lib</directory>
- <outputDirectory>lib/</outputDirectory>
- </fileSet>
- </fileSets>
- <files>
- <file>
- <outputDirectory>/</outputDirectory>
- <source>${project.basedir}\target\websocket-server-0.0.1-SNAPSHOT.jar</source>
- <destName>websocket-server.jar</destName>
- </file>
- </files>
- </assembly>
- mvn clean compile package
maven-assembly-plugin 打包简单案例的更多相关文章
- 记录一次maven打包时将test目录下的类打包到jar中,Maven Assembly Plugin的使用
今天有人问我打包后找不到主类,运行的类写在test中.按照常规,test目录下的文件不会打包到jar包中.(但是我测试一个springboot工程就可以,这里之后再研究) 具体解决如下 第一步:在po ...
- maven assembly plugin使用
使用场景 在使用maven来管理项目时,项目除了web项目,还有可能为控制台程序,一般用于开发一些后台服务的程序.最近在工作中也遇到了这种场景,使用quartz开发一个任务调度程序.程序中依赖很多ja ...
- 使用Maven Assembly plugin将依赖打包进jar
一个Eclipse的工程,在pom中配置了若干依赖,需要将pom中所有的依赖全部打包进一个jar包中,可以选择的方案有maven-assembly-plugin和fatjar.以前采用fatjar进行 ...
- java工程打成jar包 - 使用maven assembly插件打包及手动打包
在java工程打包的过程中遇到过不少问题,现在总结一下.一种是典型的maven工程打包,依赖的jar包全都在pom.xml中指定,这种方式打包很方便:另一种是依赖了本机jar包(不能通过pom.xml ...
- Maven Assembly插件介绍
转自:http://blueram.iteye.com/blog/1684070 已经写得挺好的,就不用重写了. 你是否想要创建一个包含脚本.配置文件以及所有运行时所依赖的元素(jar)Assembl ...
- maven assembly 配置详解
Maven Assembly插件介绍 博客分类: 项目构建 你是否想要创建一个包含脚本.配置文件以及所有运行时所依赖的元素(jar)Assembly插件能帮你构建一个完整的发布包. Assembl ...
- Maven Assembly打包提示[WARNING] transitive dependencies if any will not be available
maven assembly打包出现错误 [WARNING] The POM for com.flink.xxr:0.0.1-SNAPSHOT is invalid, transitive depen ...
- Maven項目打包報錯:Plugin execution not covered by lifecycle configuration
Maven項目打包報錯:Plugin execution not covered by lifecycle configuration 使用Eclipse导入一个新的maven项目时不时的会遇到这个错 ...
- 使用maven的插件进行maven项目的打包
1 maven项目打包的插件有3种 maven-jar-plugin maven-assembly-plugin maven-shade-plugin 2 maven-jar-plugin 现在要新增 ...
随机推荐
- LR----实现WebService测试
测试WebService时,需要导入WSDL:同SoapUI WSDL:http://ws.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl 场景 ...
- hdu 1211 逆元
RSA Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submiss ...
- 由浅入深了解EventBus:(二)
概念 深入学习EventBus框架,就必须理解EventBus的相关原理和一些概念: Subscribe 在EventBus框架中,消息的处理接收方法必须要“@Subscribe”注解来进行标注: p ...
- 使用aidl的项目结构以及小的注意事项
在app的build.gradle里面添加: sourceSets{ main{ java.srcDirs = ['src/main/java','src/main/aidl'] } }
- ElementTree之Xml文档处理
ElementTree: 表示整个XML层级结构 Element: 表示树形结构中所有的父节点 SubElement: 表示树形结构中所有的子节点 有些节点既是父节点,又是子节点 下面来看下这两个类的 ...
- operator[],识别读操作和写操作
body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...
- Git添加远程库
body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...
- 通过Fegin远程调用 ,返回JPA Page 对象报错
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.sp ...
- Android组件化开发实践
转载请注明出处:http://blog.csdn.net/crazy1235/article/details/76533115 http://mdsa.51cto.com/art/201707/544 ...
- css 添加伪元素 消除浮动 对父元素高度产生的影响