简体   繁体   中英

Tycho without p2

Is it possible to use Tycho without using p2 to download dependencies or publish the resulting artifacts in?

I already have a Maven repository with all the dependencies and I don't want to have a p2 repository with duplicate artifacts just to compile these osgi projects. I also want to publish the resulting artifacts in that same maven repository so that i can have a real centralized repository instead of a maven repository and a p2 repository

So basically, i want to remove the need for p2 from my build.

I know one option would be to use POM-first tools instead of tycho, but the problem is the projects were already developed using PDE so this doesn't seem like an option

Tycho can use OSGi bundles in Maven repositories pretty easily: Just specify a dependency to the bundles by their GAV in the pom.xml and set the pomDependencies=consider option (see this documentation ). Tycho will then take these artifacts for all build steps: dependency resolution, compilation, RCP assembly, etc.

The tricky part about pomDependency=consider are transitive dependencies: For any artifact that Tycho builds, it requires that all transitive dependencies of the artifact can be resolved against the target platform. With pomDependency=consider , Tycho adds the GAV artifacts and all their transitive Maven dependencies to the target platform, but only if the artifact is an OSGi bundle (hence "consider"). If one of the Maven dependencies is not an OSGi bundle then that library will not be in the target platform and hence Tycho's dependency resolution (in the OSGi space) may fail.

The second part of your question was about distributing Tycho artifacts via Maven repositories. It is possible to deploy Tycho artifacts to Maven repositories, but these artifacts are not particularly useful in the Maven world. This is because Tycho's artifacts typically don't have dependencies in their POMs. So to use a Tycho artifact from a Maven build (or similarly via pomDependency=consider ), you'd need to manually list all the dependencies of the Tycho artifact in consuming project's POM.

It is possible to tell Tycho to use POM dependencies . The only "gotcha" as far as I am aware of, is that these still need to be in a p2 repository should you wish to build an RCP application using the eclipse-repository packaging type.

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