You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by Jeremy Hughes <hu...@apache.org> on 2010/04/23 12:55:06 UTC

[DISCUSSION] ensure Aries builds with Java 1.5 libraries

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

Re: [DISCUSSION] ensure Aries builds with Java 1.5 libraries

Posted by Donald Woods <dw...@apache.org>.
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
> 

Re: [DISCUSSION] ensure Aries builds with Java 1.5 libraries

Posted by Daniel Kulp <dk...@apache.org>.
> 1. enforce all users/devs build Aries with 1.5 JDK

-1 on this.   The project should be completely buildable from a straight svn 
checkout without the user having to put custom junk in there .m2/settings.xml.   
(and it should be buildable WITHOUT a settings.xml)   Besides, isn't Java5 EOL 
soon?    I expect more and more people will be using java6 more often so 
requiring people to download and install an older JDK just to work on Aries 
can cause a tendency shrink your potential pool of contributors.


>2. only enforce build with 1.5 JDK in the release profile & configure
>Hudson to build with JDK 1.5

+1 to this.    That works fairly well for CXF.    Issues do pop up, but they 
get caught and fixed pretty quick.   The common issue is @Override annotations 
that eclipse like to stick on the implementation methods of an interface.   
Not allowed on Java5, but OK on Java6.

Likewise, I'd also have a Hudson build configured for Java6 to catch issues 
going the other way.   (we've had a couple due to parser/xsl changes, socket 
behavior changes, etc...)

Dan


On Friday 23 April 2010 6:55:06 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

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog