commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject [ALL] Compile and Test under different JVM from Maven
Date Tue, 09 Mar 2010 01:10:52 GMT
I've done some investigations.

Maven can happily compile code with Java 1.3 or 1.4 etc. even when
Maven itself runs under Java 1.5+ [1]

This can be done by adding the following to the component POM:


The variable JAVA_1_3_HOME can either be defined as:
+ an environment variable
+ added to settings.xml or
+ defined on the command line
(the above are processed in order, the last one takes precedence)

SureFire also allows a different JVM to be used:


However, the current version of Surefire (2.4.3) does not run under
1.3.1; the latest version that seems to support 1.3 is Surefire 2.2,
so the parent version needs to be overridden with that in the
component pom.

So projects requiring Java 1.3 or 1.4 can be compiled and tested under Java 1.5+

But how best to implement this?

It's important that the POMS still work even if local system only has
(say) Java 1.5, but it would be nice if Maven automatically chose the
appropriate compiler if it is available (according to the environment

It would be neat if this could be implemented in the parent pom, but I
don't know enough about profiles to know if this is possible. Can the
parent pom refer to variables defined in a child pom?

What would be ideal is to activate the settings when the component
profile specifies compiler.source which is different from the JVM
which is running Maven.  If the appropriate environment variable
exists (i.e. the compiler exists) then process the settings, otherwise
report a warning and continue.

Otherwise, if the overrides can at least be enabled by setting a
command-line parameter, that would be OK.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message