第谷跳过测试
Tycho skips Tests
我的项目使用maven构建,但在安装过程中总是跳过测试。如果我使用 -X 它会告诉我:
[DEBUG] (f) skipTests = true
这是从哪里来的?这是我的 pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>project</artifactId>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>project</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
如果有任何日志或其他文件我可以帮助找到这个问题的原因,请告诉我。
1- 使用 tycho-surefire-plugin 而不是 maven-surefire-plugin。
2- 您必须为测试定义目标平台配置。
3-所有tycho-surefire-plugin参数都可以找到here
示例:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<id>default-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration> <!--example configuration run test in windows without GUI-->
<argLine>-Xmx1024m</argLine>
<argLine>-Dosgi.arch=x86</argLine>
<useUIHarness>false</useUIHarness>
<useUIThread>false</useUIThread>
</configuration>
</plugin>
目标平台配置:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
</environments>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui.views</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
.....
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
希望这对您有所帮助。
我的项目使用maven构建,但在安装过程中总是跳过测试。如果我使用 -X 它会告诉我:
[DEBUG] (f) skipTests = true
这是从哪里来的?这是我的 pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>project</artifactId>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>project</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
如果有任何日志或其他文件我可以帮助找到这个问题的原因,请告诉我。
1- 使用 tycho-surefire-plugin 而不是 maven-surefire-plugin。
2- 您必须为测试定义目标平台配置。
3-所有tycho-surefire-plugin参数都可以找到here
示例:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution>
<id>default-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration> <!--example configuration run test in windows without GUI-->
<argLine>-Xmx1024m</argLine>
<argLine>-Dosgi.arch=x86</argLine>
<useUIHarness>false</useUIHarness>
<useUIThread>false</useUIThread>
</configuration>
</plugin>
目标平台配置:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
</environments>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui.views</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
.....
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
希望这对您有所帮助。