|Re: [tycho-user] Using Tycho P2 repository functionality while a Maven session is being setup|
Hi,Not sure if all these steps are needed but I was just trying to get something working. Also, this is in a plugin but I would like to do this in a AbstractMavenLifecycleParticipant. I will have the Tycho Jars loaded in a custom ClassRealm that is setup in the same participant so this is not my real problem.
I am interested in using the Tycho plugin to resolve bundles, their dependencies, features, etc. from P2 repositories during a Maven run but before we have any projects loaded. Specifically, I would like to do this in an AbstractMavenLifecycleParticipant in the afterSessionStart call. where I only have an initial Maven session and the execution request. I am interested in setting up custom ClassRealm(s), registering components, extending the "maven-api" ClassRealm, etc with artifacts from P2 repositories and I am hoping that I can use Tycho as a P2 client to resolve and download all needed artifacts starting from a high level bundle, or from a feature.
I'm still trying to look through the Tycho code to understand how it works and by trial and error I was able to download an IU by doing the following in a Maven plugin for a project that has Tycho extensions enabled :
P2ResolverFactory rf = equinoxServiceFactory.getService(P2ResolverFactory.class);
TargetPlatformConfigurationStub stub = new TargetPlatformConfigurationStub();
} catch (URISyntaxException e1)
ExecutionEnvironmentConfigurationStub ee = new ExecutionEnvironmentConfigurationStub("");
PomDependencyCollector collector = rf.newPomDependencyCollector();
TargetPlatform tp = rf.getTargetPlatformFactory().createTargetPlatform(stub, ee, null,
P2Resolver resolver = rf.createResolver(new MavenLoggerAdapter(logger, getLog()
P2ResolutionResult rr = resolver.resolveInstallableUnit(tp,
for (Entry e : rr.getArtifacts())
for (Object o : e.getInstallableUnits())
Is there some documentation that can help me with my use case, maybe some test cases? Any pointers or pseudocode will be greatly appreciated.
tycho-user mailing list
Back to the top