Why wouldn't source and target be hardcoded in the build?  Xerces source compliance is not a dynamic thing.  It should be hardcoded in the build to whatever is level Xerces advertises it to be.  According to the Java docs [1] the default behavior is (assuming you hardcode -source)....

"If -source is 1.3, the value of -target is 1.4"
"For all other values of -source, the value of -target is the value of -source."

I would suggest just setting both -source and -target to whatever you deem the minimum supported platform. 

For JDK1.3...
-source 1.3
-target 1.4

for JDK1.4...
-source 1.4

-target 1.4

With this, it doesn't matter which version of the JDK you compile under.  The generated binary will always work (barring API incompatibilities which do exist in, at least, StringBuffer between JDK1.3 and JDK1.4) with the minimum JDK as defined by the hardcoded -source and -target values.


[1] http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html


Jake

On Thu, 11 Nov 2010 16:48:29 -0500
 Michael Glavassevich <mrgla...@ca.ibm.com> wrote:
Eric Smith <eric225...@gmail.com> wrote on 11/11/2010 04:10:54 PM:

Hi,

When I try to build Xerces-J with gcj as my jdk, it fails with

compile:
[copy] Copying 23 files to
/var/tmp/paludis/build/dev-java-Xerces-J-2.10.0/work/xerces-2_10_0/
build/classes
[xjavac] Compiling 704 source files to
/var/tmp/paludis/build/dev-java-Xerces-J-2.10.0/work/xerces-2_10_0/
build/classes
[xjavac] Compliance level '1.5' is incompatible with source level '1.6'.
A
compliance level '1.6' or better is required

The problem is that Xerces-J is setting the source level with ant's
built-in ant.java.version, which is set incorrectly for gcj. I filed
a bug with ant at
https://issues.apache.org/bugzilla/show_bug.cgi?id=50256
but they said that Xerces-J shouldn't be using ant.java.version to
set the source level anyway, so is this a bug with Xerces-J?

No. This was intentional so that class files are generated at the same
level as the JDK used to compile Xerces. The source level cannot be lower
than the target.

Thanks,
Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to