2

We have a project which is built with Tycho 0.15.0. When running the tests (i.e. UI tests), maven executes

cmd.exe /X /C ""C:\Program Files (x86)\Java\jre7\bin\java.exe" -Dosgi.noShutdown=false -Dosgi.os=win32 [...]"

This works so far.

But now, we want to have the test instance run with a different JVM (located e.g., in c:\my_custom_jvm\jre\bin).

Is this possible to achieve? I have searched for possibilities and found the jvm option for the Maven Surefire plug-in, but this does not seem to be supported by tycho-surefire ...

For reference, here's the complete snippet of the pom.xml:

<build>
<plugins>
    <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-surefire-plugin</artifactId>
        <version>0.15.0</version>
        <configuration>
            <testSuite>my.tests</testSuite>
            <testClass>my.tests.AllTests</testClass>

            <product>my.product</product>
            <bundleStartLevel>
                <bundle>
                    <id>org.eclipse.equinox.event</id>
                    <level>4</level>
                    <autoStart>true</autoStart>
                </bundle>
            </bundleStartLevel>
            <dependencies>
                <dependency>
                    <type>p2-installable-unit</type>
                    <artifactId>my.product</artifactId>
                    <version>0.0.0</version>
                </dependency>
            </dependencies>

            <argLine>-Xmx768m -XX:PermSize=128m -Xss1m -Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook -Dequinox.ds.block_timeout=60000 -Dequinox.use.ds=true</argLine>
        </configuration>
    </plugin>
</plugins>
</build>
4

2 回答 2

2

tycho surefire 支持 maven 工具链 [1]

[1] http://maven.apache.org/guides/mini/guide-using-toolchains.html

于 2013-07-24T11:00:57.613 回答
1

(基于 jsievers 的回答)

工具链插件正是我需要的。

我在我的 pom.xml 中添加了以下几行(在标签内):

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.0</version>
<executions>
  <execution>
    <phase>validate</phase>
    <goals>
      <goal>toolchain</goal>
    </goals>
  </execution>
</executions>
<configuration>
  <toolchains>
    <jdk>
      <version>1.4</version>
      <vendor>sun</vendor>
    </jdk>
  </toolchains>
</configuration>
</plugin>

我已经创建了一个包含以下内容的toolchain.xml文件C:\Users\itsame\.m2(如果您希望将其放在其他地方,也许会有所帮助):

<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <toolchain>
     <type>jdk</type>
     <provides>
         <version>1.4</version>
         <vendor>sun</vendor>
         <id>CustomJRE</id>
     </provides>
     <configuration>
        <jdkHome>c:\my_custom_jvm\jre</jdkHome>
     </configuration>
  </toolchain>
</toolchains>

请注意,即使它是 JRE(不是 JDK),也可以运行测试。

于 2013-07-30T20:46:18.757 回答