Java Reference
In-Depth Information
You may need to adjust your Eclipse build.properties file (using the Eclipse GUI or
a text editor) to ensure nonstandard resources like the OSGI-INF folder are included
in the built JAR .
Unlike many OSG i-aware build solutions, Tycho fully honors your bundle manifest
at compile time. It doesn't take the common shortcut of working out what bundles
should be on the classpath, and then treating that classpath as a flat classpath after
that. Tycho uses the rules of OSG i to work out what's visible to your plug-in.
But how does Tycho work out what should be on the classpath in the first place? You'll
notice that there's no <dependency> section in the pom.xml—any <dependency> ele-
ments are ignored. The answer is that Tycho provisions as it builds your plug-ins.
PROVISIONING
Provisioning is nothing new for Maven users—every time Maven downloads a JAR from
the Maven repository, it's provisioning—but the way Tycho provisions is both sophisti-
cated and convenient. Dependencies are implicitly declared by Import-Package: state-
ments, rather than explicitly declared with <dependency> elements. Tycho will look for
bundles with matching package exports in its repository.
Where do the repositories come from? Tycho can't provision against a normal
Maven repository, because it doesn't know which bundles export which packages.
Clearly, downloading everything in the Maven repository to read all the bundle mani-
fests isn't practical. (You may suspect your normal Maven builds already download
everything , but trust us, there's more in there!)
When Tycho runs the install goal, it adds extra metadata to the local Maven reposi-
tory along with the built bundles. This metadata allows it to quickly identify and down-
load bundles with appropriate package exports when building. For example, this
allows it to work out that it should add the fancyfoods.api bundle to the classpath
when building the fancyfoods.cheese.department bundle (assuming you built the
api bundle first, using Tycho!).
But you're not going to build all your external dependencies using Tycho before
trying to build your product. Tycho can be configured to provision against external
repositories. Unfortunately, these repositories must be in the p2 format. (For a
refresher on p2, see section 7.3.2). Although p2 repositories are widely available for
Eclipse-based projects, the format isn't common outside the Eclipse ecosystem. This
limits the utility of Tycho for non-Eclipse-based OSG i development. But with elbow
grease you can make Tycho provisioning work for enterprise OSG i, and you may find
the benefits of Tycho outweigh the clunkiness of getting the provisioning going.
You have two options for making your external dependencies visible to Tycho's
provisioner. The first is to step back to a slightly modified version of Maven's normal
dependency declarations. The other is to generate your own p2 repository.
USING MAVEN DEPENDENCIES
Although Tycho normally ignores Maven's <dependency> elements, it can be config-
ured to consider them in its provisioning by adding the following plug-in configuration:
Search WWH ::




Custom Search