从 tycho-surefire-plugin 中排除一个模块

Excluding a module from tycho-surefire-plugin

在我的第谷测试项目中,我有一个可选的传递依赖项,我需要排除它才能使测试执行正常工作。该传递依赖性是同一反应器构建的一部分。

我尝试过的:

<build>
    <plugins>
        <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-surefire-plugin</artifactId>
                    <version>${tycho-version}</version>
                    <configuration>
                        <dependencies>
                            <plugin>
                               <groupId>org.eclipse.tycho</groupId>
                               <artifactId>target-platform-configuration</artifactId>
                               <version>${tycho-version}</version>
                               <configuration>
                                  <filters>
                                     <filter>
                                        <type>eclipse-plugin</type>
                                        <id>my.transitive.dependency</id>
                                        <removeAll />
                                     </filter>
                                  </filters>
                               </configuration>
                            </plugin>
                        </dependencies>
            </configuration>
        </plugin>
    </plugins>
  </build>

但这在语法上似乎不正确:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:1.1.0:test (default-test) on project com.conti.xcit.generation.tests: Unable to parse configuration of mojo org.eclipse.tycho:tycho-surefire-plugin:1.1.0:test for parameter configuration: Cannot find 'configuration' in class org.apache.maven.model.Dependency -> [Help 1]

如何实现这种排除?

您可以查看以下内容link。

https://www.eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#excludes

您必须使用排除选项。

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-surefire-plugin</artifactId>
  <configuration>
    <excludes>
      <exclude>**/Test*.class</exclude> 
    </excludes>
  </configuration>
</plugin>

需要从目标中过滤掉。它适用于外部依赖项和来自构建反应器的依赖项。

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <configuration>
                    <dependency-resolution>
                        <optionalDependencies>ignore</optionalDependencies>
                    </dependency-resolution>
                    <filters>
                        <filter>
                            <type>eclipse-plugin</type>
                            <id>myExternalOptionalDependencyArtifactId</id>
                            <removeAll />
                        </filter>
                        <filter>
                            <type>eclipse-plugin</type>
                            <id>myOptionalReactorDependencyArtifactId</id>
                            <removeAll />
                        </filter>
                    </filters>
                </configuration>
            </plugin>