Option #2 - only force using Java SE 5 when building a release and for
Hudson builds.

We do something different in OpenJPA 2.x than what you are proposing
here, in that we provide a test-java5 profile so we can validate that
our junits still pass when run on Java SE 5, even though we build the
runtime with Java SE 6 -


<profile>
    <id>test-java5</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <properties>
        <java5.home>"java5.home - Must be user supplied"</java5.home>
    </properties>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                        <excludes>
                            <exclude>none</exclude>
                        </excludes>
                        <testExcludes>
                            <exclude>**</exclude>
                        </testExcludes>
                    </configuration>
                    <executions>
                        <execution>
                            <id>compile-java5</id>
                            <configuration>
                                <fork>true</fork>

<executable>${java5.home}/bin/javac</executable>
                                <compilerVersion>1.5</compilerVersion>
                                <maxmem>${test.jvm.maxheapsize}</maxmem>
                                <excludes>
                                    <exclude>**</exclude>
                                </excludes>
                                <testExcludes>
                                    <exclude>none</exclude>
                                </testExcludes>
                            </configuration>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</profile>



-Donald



On 4/23/10 6:55 AM, Jeremy Hughes wrote:
> 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