Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-build-dev] Classpath order in PDE builds


The compiler internally prepends the bootclasspath to the regular classpath the pde.build generates.  In the absence of access rules*, it will take the first class it finds.

This means that your solution is probably the easiest, with the following caveat:
The bootclasspath passed to javac is actually conditional on the Bundle-RequiredExecutionEnvironment from the manifest, if you are not using this header then your bootclasspath property will work, however for bundles with the header this won't work.

Take a look at a generated build.xml for your bundle (Right click on the manifest-> PDE Tools -> Create Ant Build File. and take a look near the top where bundleBootClasspath is set.

In an export, you don't really have the opportunity to override  the bundleBootClasspath in the same way you could for a headless build.

* Access rules control which packages you are allowed to use from a given jar.  PDE/Build automatically generates these for you for other bundles on the classpath but does not generate them for bootclasspath jars.  (See the auto generated javaCompiler.*.args).  In theory, it would be possible to provide a set of access rules telling the compiler not to use the DOM from the JDK.  But again, this level of control is not available in an export from the UI.  You would need to do the build headless.

-Andrew



Mirko Raner <mirko@xxxxxxxx>
Sent by: pde-build-dev-bounces@xxxxxxxxxxx

02/19/2008 06:44 PM

Please respond to
"Eclipse PDE Build developers list." <pde-build-dev@xxxxxxxxxxx>

To
"Eclipse PDE Build developers list." <pde-build-dev@xxxxxxxxxxx>
cc
Subject
Re: [pde-build-dev] Classpath order in PDE builds





I might have just found the answer myself...
Adding the following line to build.properties seems to fix the problem:

bootClasspath=xml-apis.jar:${java.home}/lib/rt.jar

Is this a clean solution? Or am I abusing or bypassing something in the PDE
build procedure here?

Mirko

Quoting Mirko Raner <mirko@xxxxxxxx>:

> Hello PDE Developers,
>
> first of all, sorry for intruding on a developer mailing list, but I
> couldn't find a newsgroup that seemed appropriate for my question.
>
> I have an Eclipse plug-in that depends on JDK 1.4 and DOM level 3. The
> JDK
> 1.4 libraries contain only the DOM level 2 API, so the plug-in brings its
> own xml-apis.jar, which is added to the Bundle-ClassPath attribute in the
> MANIFEST.MF file. To prevent the DOM level 2 libraries from being picked
> up, the plug-in's compile-time classpath lists the plug-in dependencies
> container before the JRE system library, i.e.:
>
>  <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
>  <classpathentry kind="con"
> path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
>
> So, as far as the regular Java builders are concerned everything compiles
> fine.
> Now, when I want to package the plug-in for distribution on an update
> site
> using the "Export -> Deployable Features" wizard I get a number of
> compilation errors that clearly indicate that the PDE build is compiling
> against the DOM Level 2 API. For example, I get errors like "The method
> adoptNode(Node) is undefined for the type Document" (which it isn't in
> DOM
> Level 2).
>
> My build.properties file contains an extra entry for the DOM Level 3 API
> and
> implementation that ship with the plug-in:
>
> jars.extra.classpath=xml-apis.jar, xercesImpl.jar
>
> This entry undoubtedly adds those JARs to the classpath, but
> unfortunately
> after the JDK 1.4 libraries. Consequently, the PDE build compiles against
> the DOM Level 2 that comes with JDK 1.4.
>
> Unfortuntately, the "quick fix" of compiling and running with JDK 1.5
> (which
> includes DOM Level 3) is not an option for me at this point. Also, there
> is
> the general question how to handle situations where one needs to override
> an API that is included in the JDK with a more up-to-date version of that
> same API (I'm sure that newer versions exists for a lot of the 3rd party
> APIs that are included in JDK 1.5).
>
> Is there a general way to specify the order of classpath entries in the
> build.properties file?
>
> Thanks in advance for any pointers and suggestions!
>
> Mirko
>
> _______________________________________________
> pde-build-dev mailing list
> pde-build-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/pde-build-dev
>
>

_______________________________________________
pde-build-dev mailing list
pde-build-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-build-dev


Back to the top