标签:maven
maven-jar-plugin 插件的maven依赖为:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</dependency>一: 打包可执行的jar
配置为:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.lala.shop.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<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>
</plugins>
</build>
二: 打包部分package
比如说,我只想打包com.lala.api*下面的类打包,则配置如下
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <configuration> <includes> <include>**/api/*</include> </includes> </configuration> </plugin> </plugins> </build>
maven技术交流 扣扣群 379165311,群里面会不定期分享一些maven文章和教程,欢迎大家加入
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:maven
原文地址:http://blog.csdn.net/mn960mn/article/details/47065993