简体   繁体   中英

Running Eclipse inside Tycho using reactor artifacts

Is there a way to make the tycho-eclipserun-plugin:eclipse-run goal resolve dependencies against artifacts in the current reactor or in the local repository . I'm trying to run the Eclipse/CDT headless build application as a step in our Tycho build, but I cannot figure out how to populate the Eclipse instance with the newly-built toolchain plugins.

<plugin>
    <groupId>org.eclipse.tycho.extras</groupId>              
    <artifactId>tycho-eclipserun-plugin</artifactId>
    <executions>
    <execution>
        <configuration>
        <appArgLine>-application org.eclipse.cdt.managedbuilder.core.headlessbuild -import file:///...  -cleanBuild all</appArgLine>
                <repositories>
                    <repository>
                        <url>http://download.eclipse.org/releases/kepler/</url>
                        <layout>p2</layout>
                    </repository>
                </repositories>
                <dependencies>
                    ...
                    <dependency> 
                        <artifactId>my.toolchain.feature</artifactId>
                        <type>eclipse-feature</type>
                    </dependency>
        </dependencies>
            </configuration>
            <goals>
                <goal>eclipse-run</goal>
            </goals>
            <phase>test</phase>
        </execution>
    </executions>
 </plugin>

This will fail since my toolchain plugins are not present in the Eclipse instance which hosts the headless build application. I could, of course, point out an external update site which hosts the plugins, but I would like to be able to use the plugins which are already being built in the same reactor. Is that possible?

EDIT: Original question included "or local repository artifacts", but that was not what I actually meant.

No, this is not possible.

Earlier versions of Tycho allowed using artifacts from the reactor for the eclipserun-plugin, but this caused problems for projects which build upstream artifacts from the artifacts they used for the eclipserun-plugin , namely the Eclipse Platform. So to fix this, the artifacts used by the eclipserun-plugin were decoupled from the reactor & reactor dependencies in Tycho 0.17.0 .

One could imagine ways to re-allow this use case, but this is currently just not implemented. AFAIK there are no concrete ideas yet how to do this. If you want to contribute one, you could file an enhancement in Tycho's issue tracker .

The easiest way I could find is to use the maven-dependency-plugin to copy the repository from the repository-module:

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
        <execution>
            <goals>
                <goal>unpack</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>com.iar</groupId>
                        <artifactId>my.toolchain.repository</artifactId>
                        <version>0.0.1-SNAPSHOT</version>
                        <type>zip</type>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

This will copy and unpack the repository locally. It can then be specified as a repository when calling the eclipserun target:

<repository>
    <url>file://${project.build.directory}/dependency</url>
    <layout>p2</layout>
</repository>

The only thing you need to know is the GAV of the "eclipse-repository" module which contains the repository you need.

EDIT: This turned out to not work as I expected. It will pull artifacts from the local repository, and not from the reactor as I expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM