First thought this is will overly complicate the maven build. Also I
just restored compatibility for JDK 1.4[1] so its only JDK 1.3. We
have Ant builds for JDK 1.3 components - can Continuum run Ant?

Niall:

[1] http://markmail.org/message/7xlgzzefqsfz4no2

On Tue, Mar 9, 2010 at 1:10 AM, sebb <seb...@gmail.com> wrote:
> 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:
>
> <build>
>   <plugins>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-compiler-plugin</artifactId>
>        <configuration>
>          <fork>true</fork>
>          <executable>${JAVA_1_3_HOME}/bin/javac</executable>
>          <compilerVersion>${maven.compile.source}</compilerVersion>
>        </configuration>
>
> 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:
>
> <artifactId>maven-surefire-plugin</artifactId>
>  <configuration>
>     <jvm>${JAVA_1_4_HOME}/bin/java</jvm>
>
> 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
> variables).
>
> 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.
>
> 1] 
> http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to