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>
cb4
  • 6,689
  • 7
  • 45
  • 57
Stefan Winkler
  • 3,871
  • 1
  • 18
  • 35
  • It is great that you took an answer and added more details to it - this will probably greatly help others to apply it. But your detailed solution should also be posted as answer. SO encourages to answer your own questions, and as long as you give proper attribution the content you re-used (as you already did), there is nothing wrong with re-using other answers for an own answer. – oberlies Jul 26 '13 at 15:23
  • Thank you for your feedback. I have restructured the question and added the solution as the accepted answer. – Stefan Winkler Jul 30 '13 at 20:47

2 Answers2

2

tycho surefire has support for maven toolchains [1]

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

jsievers
  • 1,853
  • 10
  • 13
1

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

Community
  • 1
  • 1
Stefan Winkler
  • 3,871
  • 1
  • 18
  • 35