【发布时间】:2019-06-07 15:05:23
【问题描述】:
我有一个 java 项目,其中有 3 个“级别”。 我的顶级 maven 目录中的 pom 如下所示:
<groupId>com.my_app</groupId>
<artifactId>my_app</artifactId>
<version>LATEST-SNAPSHOT</version>
<modules>
<module>first_module</module>
<module>second_module</module>
</modules>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<parallel>classes</parallel>
<threadCount>10</threadCount>
</configuration>
</plugin>
</plugins>
first_module(第二级)pom是:
<parent>
<groupId>com.my_app</groupId>
<artifactId>my_app</artifactId>
<version>LATEST-SNAPSHOT</version>
</parent>
<groupId>com.my_app.first_module</groupId>
<artifactId>first_module</artifactId>
<version>LATEST-SNAPSHOT</version>
...
<plugins>
<plugin>
<version>2.22.1</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
最后,(3rd level)项目中实际包含测试类的 pom:
<parent>
<artifactId>first_module</artifactId>
<groupId>com.my_app.first_module</groupId>
<version>LATEST-SNAPSHOT</version>
</parent>
<artifactId>my_project</artifactId>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
</plugins>
我的问题是 - 这种 pom 结构是否允许从顶部到底部 pom 的配置继承?我的意思是,如果我在 maven-sirefure-plugin 的第一个 pom 中有 parallel 配置 - 它会在 first_module 下的测试类中生效> 并在 my_project 下?
【问题讨论】:
标签: java junit pom.xml maven-surefire-plugin parent-pom