Maven的几个常用plugin
程序员文章站
2024-03-07 21:41:03
maven-compiler-plugin
编译java源码,一般只需设置编译的jdk版本
o...
maven-compiler-plugin
编译java源码,一般只需设置编译的jdk版本
<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包到指定的文件夹里
<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中
<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>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!