hello-friend 2017-08-15 09:11 采纳率: 100%
浏览 792
已结题

maven3 2个问题求解答 网上搜不到

  1. maven的内置插件是在哪里定义的 有哪些内置插件 看了源码里的主pom,只有以下插件
 - <pluginManagement>
- <!--  NOTE: These plugins will be removed from future versions of the super POM 
  --> 
- <!--  They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) 
  --> 
- <plugins>
- <plugin>
  <artifactId>maven-antrun-plugin</artifactId> 
  <version>1.3</version> 
  </plugin>
- <plugin>
  <artifactId>maven-assembly-plugin</artifactId> 
  <version>2.2-beta-5</version> 
  </plugin>
- <plugin>
  <artifactId>maven-dependency-plugin</artifactId> 
  <version>2.8</version> 
  </plugin>
- <plugin>
  <artifactId>maven-release-plugin</artifactId> 
  <version>2.3.2</version> 
  </plugin>
  </plugins>
  </pluginManagement>

2、我在我自己的父pom里声明了插件

 <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <useDefaultDelimiters>false</useDefaultDelimiters>
                        <delimiters>
                            <delimiter>$[*]</delimiter>
                        </delimiters>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <format>xml</format>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement> 

但我在其他子模块中并没有用这些插件,但是这些插件还是起作用了,为什么?

  • 写回答

1条回答 默认 最新

  • JPF1024 2017-08-15 15:59
    关注

    1.
    里面有super pom,参考:

    http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

    2.

    http://maven.apache.org/plugins/index.html
    大意是:在build标签里面的都会运行.

     Build plugins will be executed during the build and they should be configured in the <build/> element from the POM.
    
    评论

报告相同问题?