Several commonly used plug-ins of Maven and commonly used plug-ins of Maven
Maven-compiler-plugin
Compile the Java source code. Generally, you only need to set the compiled jdk version.
<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
Copy the dependent jar package to the specified folder.
<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
Set manifest parameters, for example, specify the Main class to be run, as well as dependent jar packages, and add them to 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>