在dependencyManagement上使用maven-dependency-plugin

时间:2015-02-17 09:43:49

标签: java maven

我尝试使用maven-depdency-plugin列出在POM的dependencyManagement部分中声明的依赖项。

示例:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <configuration>
                <excludeTypes>war</excludeTypes>
                <includeScope>runtime</includeScope>
                <excludeScope>provided</excludeScope>
            </configuration>
            <executions>
                <execution>
                    <id>list</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>list</goal>
                    </goals>
                    <configuration>
                        <sort>true</sort>
                        <outputFile>${project.build.directory}/dependencies.txt</outputFile>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

但是当我运行mvn validate时,生成的文件为空:

The following files have been resolved:
   none

该插件仅适用于POM的dependencies部分?

0 个答案:

没有答案