Maven常用插件集合
2013-06-09 15:55
381 查看
在这里记录常用的插件,以备用时可快速查询,会持续更新
1. maven-compile-plugin
官方介绍 http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
在pom.xml文件中默认编译级别是1.5,如果需改成1.6,可以在pom.xml中增加如下配置
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
extensions表示继续默认的配置,这里只是修改了编译jdk为1.6
2. maven-bundle-plugin
官方介绍 http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.my.company.api</Export-Package>
<Private-Package>com.my.company.*</Private-Package>
<Bundle-Activator>com.my.company.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
3. maven-dependency-plugin
官方介绍 http://maven.apache.org/plugins/maven-dependency-plugin/
1. maven-compile-plugin
官方介绍 http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
在pom.xml文件中默认编译级别是1.5,如果需改成1.6,可以在pom.xml中增加如下配置
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
extensions表示继续默认的配置,这里只是修改了编译jdk为1.6
2. maven-bundle-plugin
官方介绍 http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.my.company.api</Export-Package>
<Private-Package>com.my.company.*</Private-Package>
<Bundle-Activator>com.my.company.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
3. maven-dependency-plugin
官方介绍 http://maven.apache.org/plugins/maven-dependency-plugin/
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.8</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>true</overWriteSnapshots>
<overWriteIfNewer>true<overWriterIfNewer>
<excludeArtifactIds>servlet-api<excludeArtifactIds> </configuration> </execution> </executions> </plugin>
这个配置可以把所有的依赖拷贝到lib目录下,通过maven-jar-plugin就可以将lib下面的jar包打到最终的jar里面
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>${project.build.directory}/lib</classesDirectory>
</configuration>
</execution>
</executions>
</plugin>
4. maven-war-plugin
官方介绍:http://maven.apache.org/plugins/maven-war-plugin/
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>resource2</directory><!--打包时包含这个目录的内容-->
<excludes> <!--排除一些目录--></resource>
<exclude>**/properties</exclude>
</excludes>
</webResources>
</configuration>
</plugin>
相关文章推荐
- 常用maven插件配置汇总
- maven学习总结:几个常用的maven插件
- Maven常用插件
- maven常用插件和mvn test命令
- Maven常用插件
- Maven常用插件配置和使用
- 常用Maven插件介绍
- vim/gvim常用插件集合
- maven常用插件实用技巧
- [maven] 常用插件解析
- Maven实战(七)——常用Maven插件介绍(上)
- 学习笔记——Maven实战(八)常用Maven插件介绍(下)
- Maven常用插件参数
- maven常用插件和mvn test命令
- Maven常用插件使用说明之deploy
- maven常用插件记录
- 【maven常用插件】打包源码 / 跳过测试 / 单独打包依赖项
- 常用Maven插件介绍(下)
- Maven常用插件配置和使用
- jquery-常用插件集合