We're using Java 1.6 JRE library additions in Aries. We've tried to
make sure Aries builds with 1.5 libraries. While we have the necessary
configuration on the maven-compiler-plugin to ensure the bytecode is
1.5 compatible, the compile fail if there's a 1.6 JRE library
dependency. What's required is for the compiler plugin to ensure it is
really using a 1.5 JDK. This can be done by adding this to the
compiler plugin config in parent/default-parent/java5-parent/pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
+       <fork>true</fork>
+       <executable>${JAVA_1_5_HOME}/bin/javac</executable>
        <source>1.5</source>
        <target>1.5</target>
    </configuration>
</plugin>

and setting the JAVA_1_5_HOME variable in .m2/settings.xml like this:

<settings>
  <profiles>
    <profile>
        <id>aries-compiler</id>
        <properties>
          <JAVA_1_5_HOME>...java home dir of v1.5 jdk...</JAVA_1_5_HOME>
        </properties>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>aries-compiler</activeProfile>
  </activeProfiles>
...
</settings>

Personally I'd like to make sure everyone building Aries is configured
like this but there are pros/cons:

pro: anyone building Aries does so with a v1.5 JDK ensuring there are
failures if a java 6 library dependency has crept in
con: settings.xml has to be configured (that's a v. small con IMO)
con: users downloading sources.zip will also need to configure
settings.xml (also small but might put some people off slightly).

Another option would be to only enforce building with a v1.5 JDK in
the release profile - but this effective defers all checking for java
6 dependencies to release time. A compromise would be to configure
Hudson to build with a 1.5 JDK, allow devs and users (using sources
zip) to build with their default JDK.

I'd just like to get opinion on these options:

1. enforce all users/devs build Aries with 1.5 JDK
2. only enforce build with 1.5 JDK in the release profile & configure
Hudson to build with JDK 1.5

Any more options?

Thanks,
Jeremy

Reply via email to