Tycho skips Tests

孤街浪徒 提交于 2019-12-11 08:03:32

问题


My project uses maven to build, but during install it always skips the tests. If i use -X it tells me:

[DEBUG]   (f) skipTests = true

Where does this come from? This is my 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>

If there is anything log or additional files i can contribute to help find the cause of this, let me know.


回答1:


1- use tycho-surefire-plugin instead of maven-surefire-plugin.

2- you have to define the target-platform-configuration for the test.

3- all tycho-surefire-plugin Parameters can be found here

Example:

<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>

target-platform-configuration:

  <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>

hope this helps.



来源:https://stackoverflow.com/questions/37016338/tycho-skips-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!