You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mark Hobson <ma...@gmail.com> on 2005/09/21 19:45:48 UTC

[m2] Portable way of specifying JDKs in compiler plugin

Hi all,

I have a project that is targetted for a JDK 1.4.2 environment and
implements the DOM Level 2 API that is supplied in the corresponding
rt.jar.  I need to be able to build this project with m2 on a system
that has both JDK 1.5 (the default) and JDK 1.4.2 installed.  The
project cannot be compiled against the 1.5 rt.jar alone since this
contains DOM Level 3 API, which specifies many more methods.

The options seem to be:

1) Fork the compiler and supply an executable config param to point to
the system-dependant JDK 1.4.2 javac, thus using the 1.4.2 rt.jar and
hence DOM Level 2 API.

2) Be able to include the DOM Level 2 API in the bootclasspath, thus
over-riding the DOM Level 3 API in JDK 1.5's rt.jar.

I'm not a big fan of (1) since system-specific information will be
held within the POM.  Even if I use an expression like
"${java.home}/../jdk1.4.2/bin/javac", this still assumes something
about the whereabouts of the JDK.  For these scenarios, do you think
it would make sense to introduce a JDK version compiler config param
which cross-referenced a list of JDK definitions in settings.xml?  The
resolved java.home could then be used in the plexus-compiler-*
projects when deriving the necessary rt.jar path.

I prefer (2), but it appears there's no way of specifying the
bootclasspath in plexus-compiler-api.  Ideally my project would have a
DOM Level 2 API dependency which I could flag as a bootclasspath jar
(yet another scope?) and that would take precendence over whatever JDK
I was using.

I'd be interested in what options I have to achieve just compliation
in this setup using m2 beta1, and also how this problem could be
tackled more elegantly in future.

Cheers,

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Portable way of specifying JDKs in compiler plugin

Posted by Mark Hobson <ma...@gmail.com>.
For any avid readers..

On 21/09/05, Mark Hobson <ma...@gmail.com> wrote:
[snip]
> I'm not a big fan of (1) since system-specific information will be
> held within the POM.  Even if I use an expression like
> "${java.home}/../jdk1.4.2/bin/javac", this still assumes something
> about the whereabouts of the JDK.  For these scenarios, do you think
> it would make sense to introduce a JDK version compiler config param
> which cross-referenced a list of JDK definitions in settings.xml?  The
> resolved java.home could then be used in the plexus-compiler-*
> projects when deriving the necessary rt.jar path.

See MNG-468, but hardcoding the JDK doesn't currently work due to MNG-862.

> I prefer (2), but it appears there's no way of specifying the
> bootclasspath in plexus-compiler-api.  Ideally my project would have a
> DOM Level 2 API dependency which I could flag as a bootclasspath jar
> (yet another scope?) and that would take precendence over whatever JDK
> I was using.

See MNG-973 and also MNG-1020 for this to work in eclipse.

> I'd be interested in what options I have to achieve just compliation
> in this setup using m2 beta1, and also how this problem could be
> tackled more elegantly in future.

I couldn't find a way of doing this with beta1 due to the above issues :(

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org