Question

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>
Was it helpful?

Solution 2

(based on answer by jsievers)

The toolchain plugin does exactly what I need.

I added the following lines to my pom.xml (inside the tag):

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

And I have created a toolchain.xml file in C:\Users\itsame\.m2 (if you want it to place elsewhere, maybe this helps) with these contents:

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

Note that even though it is a JRE (not a JDK), this works to run the tests.

OTHER TIPS

tycho surefire has support for maven toolchains [1]

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top