maven 常用外掛
阿新 • • 發佈:2019-01-28
1 maven-compiler-plugin
[html] view plaincopyprint?- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <source>1.6</source>
-
<target>1.6</target
- </configuration>
- </plugin>
2 maven-dependency-plugin 把依賴的jar包拷到指定目錄下 [html] view plaincopyprint?
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
-
<executions
- <execution>
- <id>copy-dependencies</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
-
<
- <excludeArtifactIds>
- module1,module2
- </excludeArtifactIds>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- </configuration>
- </execution>
- <execution>
- <id>copy-modules</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeArtifactIds>
- module1,module2
- </includeArtifactIds>
- <outputDirectory>${project.build.directory}/lib/modules</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
3 maven-resources-plugin 把依賴的資源拷到指定目錄下
[html] view plaincopyprint?- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>copy-resources</id>
- <!-- here the phase you need -->
- <phase>validate</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/target/test-classes</outputDirectory>
-
<