Java Reference
In-Depth Information
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
Sadly, at the time of writing, Tycho would not resolve transitive dependencies (the
dependencies of your dependencies). This means you'll have to list more dependen-
cies in your pom files than you would if you weren't using Tycho! But you may find
that listing the dependencies isn't too onerous if you list all the external dependencies
for your project in a single parent pom file. Internal dependencies will still be han-
dled automatically by Tycho.
You may find that managing your dependency list quickly becomes tedious. One
way of managing it is to write scripts that autogenerate it from your runtime environ-
ment. Files in the JAR 's META-INF /maven folder can be used to work out every JAR 's
group and artifact ID , and so you can work out a complete <dependencies> element
by scanning every JAR in the deploy directory.
Generating your own p2 repository
Another option is to bypass the <considerDependencies> route entirely and generate
your own p2 repository. Eclipse provides command-line tools for doing this. Generat-
ing your repository directly from your runtime environment has some advantages over
normal Maven dependency management; because you know the compile-time envi-
ronment is identical to the runtime environment, you don't risk building bundles that
compile against the latest and greatest available from a Maven repository, but then fail
miserably at runtime when required bundles are either back-level or missing entirely.
To generate the p2 repository, you'll first need to copy all your runtime bundles
into a folder called plugins, inside a holding folder, ${bundles.dir}. Then run the fol-
lowing command
${eclipse.home}/eclipse -nosplash -application
org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
-metadataRepository file:${repository.dir}
-artifactRepository file:${repository.dir}
-source ${bundles.dir} -compress -publishArtifacts
where ${eclipse.home} is an Eclipse installation and ${repository.dir} is the output
directory for your repository.
You now have a p2 repository that exactly represents the bundles available in your
runtime environment. To configure Tycho to use it, add the following to your
pom.xml (or to a parent pom.xml):
<repositories>
<repository>
<id>runtime-environment</id>
Search WWH ::




Custom Search