Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] Calling Tycho / Maven Ninjas



Chris Aniszczyk wrote:
On Tue, Jan 19, 2010 at 3:22 PM, Igor Fedorenko <ifedorenko@xxxxxxxxxxxx> wrote:
I think I fixed it, at least the build works on my linux desktop. See
attached pom-cleanup.diff. I basically moved all tycho configuration to
the parent pom to make sure it is consistently applied to all modules.
Most likely one of the modules missed a dependency.

Thanks! I was able to use your patch to get things off the ground. I
had to fix the EGit feature also to not bundle the JGit feature.

This is odd, I did not need to change anything. Do you remember the
error Tycho was spitting?


I attached a new patch for people to try:
     http://egit.eclipse.org/r/#change,224

I can provide more detailed explanation, if anyone is interested in what
is actually going on under the hood.

I would be interested :)


I was afraid you would ask ;-) Kinda lengthy, but here it goes...

First, couple of general comments before I go into EGit build.

I don't want to go too deep into this, but it is important to understand
that dependency resolution works very differently in OSGi and Maven. It
is not possible to map between Maven and OSGi dependencies, at least not
in general case, and Tycho does not try to do that. Instead, during the
build Tycho maintains its own dependency model according to OSGi/Eclipse
dependency resolution metadata and rules.

Tycho dependency resolution is always a two-phase process. First, it
determines project build target platform. Second, it calculates actual
project dependencies using the build target platform. First phase, i.e.
target platform resolution, is configurable via pom.xml. Target platform
is resolved for each project independently, so different projects can
have different configurations or even use different target platform
resolvers. Second phase is not user-configurable, but is implemented
differently for different project types. Tycho uses Equinox resolver for
eclipse-plugin and eclipse-test-plugin projects and it has some custom
resolution code for other project types.

EGit build uses P2-based target platform resolver with what I call
"implicit target platform specification". This basically means that
Tycho takes project metadata (bundle manifest,mf, feature.xml, etc),
generates p2 metadata from it, then invokes p2 resolver to resolve
project direct and indirect dependencies using installable units from
all available sources (more on this below). If p2 resolver came up with
a solution, Tycho downloads all depenencies caches them in Maven local
repository.

p2-based target platform resolver can directly work with "native" p2
repositories, but it needs help with old-style update sites and Maven
repositories. As I mentioned above, it is not possible to map between
Maven and OSGi/Eclipse metadata in general case, so we play some tricks
around this.

Tycho always keeps track of all p2 artifacts it downloads or installs to
maven local repository in
${localRepository}/.meta/p2-metadata.properties file, so it has
efficient way to work with local repo.

For other maven artifacts, EGit parent pom.xml configures target
platform resolver to "consider" maven dependencies, which means it will
take regular maven dependencies defined in <dependencies/> section of
the pom, generate p2 metadata (if possible) and feed it to p2 resolver
along with metadata from native p2 repositories.

To recap, using org.eclipse.egit.core as an example, here is how
Tycho resolves dependencies


* generates p2 dependency metadata for the project
* collects available installable units from local maven repository.
* collects available IUs from galileo p2 repository, as configured
  in the parent pom.xml
* generates p2 metadata for all org.eclipse.egit.core maven dependencies
  (again, configured in the parent pom) and adds to the available IUs
* invokes p2 resolver with project dependencies and available IUs
* downloads all required artifacts from galileo repo and caches them in
  maven local repository
* invokes equinox resolver to resolve actual project dependencies

Hope this makes sense.

--
Regards,
Igor


Back to the top