1. 程式人生 > >Maven的插件管理

Maven的插件管理

插件 配置 art exe compiler ring pom nbsp 過程

<pluginManagement>

這個元素和<dependencyManagement>相類似,它是用來進行插件管理的。

在我們項目開發的過程中,也會頻繁的引入插件,所以解決這些復雜配置的方法就是使用插件管理

我們可以在父POM中做如下聲明:

  1. <pluginManagement>
  2. <plugins>
  3. <plugin>
  4. <groupId></groupId>
  5. <artifactId></artifactId>
  6. <version></version>
  7. <executions> //插入點表達式
  8. <execution>
  9. <id></id>
  10. <goals>
  11. <goal></goal>
  12. </goals>
  13. <phase></phase>
  14. <configuration>
  15. <source></source>
  16. <target></target>
  17. </configuration>
  18. </execution>
  19. </executions>
  20. </plugin>
  21. </plugins>
  22. </pluginManagement>
  23. </build></span>

在子模塊中,我們可以直接繼承

  1. <span style="font-size:12px;"><build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-compiler-plugin</artifactId>
  6. </plugin>
  7. </plugins>
  8. </build></span>

我們會發現,繼承的細節上和<dependencyManagement>幾乎一樣。

Maven的插件管理