maven-compiler-plugin
编译Java源码,一般只需设置编译的jdk版本
1
2
3
4
5
6
7
8
9
|
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version> 3.6 . 0 </version> <configuration> <source> 1.8 </source> <target> 1.8 </target> </configuration> </plugin> |
maven-dependency-plugin
用于复制依赖的jar包到指定的文件夹里
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version> 2.10 </version> <executions> <execution> <id>copy-dependencies</id> <phase> package </phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin> |
maven-jar-plugin
打成jar时,设定manifest的参数,比如指定运行的Main class,还有依赖的jar包,加入classpath中
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version> 2.4 </version> <configuration> <archive> <manifest> <addClasspath> true </addClasspath> <classpathPrefix>/data/lib</classpathPrefix> <mainClass>com.zhang.spring.App</mainClass> </manifest> </archive> </configuration> </plugin> |
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持服务器之家!
原文链接:http://www.cnblogs.com/zhangxh20/p/6298062.html