Why tycho-surefire-plugin:test considers Bundle-ClassPath instead of bin.includes?

664 views Asked by At

In my eclipse plugin project. I have a specific jar that I need it to be visible in the build process specially in test phase, However I don't need it to be visible in runtime of the eclipse plugin. I find that tycho-surefire-plugin is using the jars which existing in Bundle-ClassPath of the MANIFEST.MF instead of bin.includes of build.properties. Is there any way to force tycho-surefire-plugin to get its classpath from build.properties instead of MANIFEST.MF? as I see this is the normal difference between the two files.

My fragment test project pom is the following:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.myproject</groupId>
        <artifactId>projectparent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../../../../projectparent/pom.xml</relativePath>
    </parent>

    <artifactId>com.myproject.projecttest</artifactId>
    <packaging>eclipse-test-plugin</packaging>
    <name>${project.artifactId}</name>
    <description>
        Tests for my project
    </description>

    <properties>
        <maven.site.skip>true</maven.site.skip>
        <maven.site.deploy.skip>true</maven.site.deploy.skip>
    </properties>
</project>
1

There are 1 answers

1
Hisham Khalil On

If I have correct understood your question:

  • you have some dependencies, that you need to use them only during the testing phase but not including them in your product.

for doing this you have to use the target-platform-configuration plugin for the test and then specifying extraRequirements to include your test only dependencies.

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

include this in your test pom.

hope this helps.