You are viewing a plain text version of this content. The canonical link for it is here.
Posted to builds@apache.org by sebb <se...@gmail.com> on 2015/01/08 11:05:47 UTC

Jenkins: what Java versions are available for building with Maven?

I have been trying to test Commons Math build on Jenkins.

It runs fine if I choose Java 1.6 latest, however Math currently targets 1.5.

If I try building using Java 1.5, Jenkins complains about class file
incompatibility.

So it looks like Jenkins needs a minimum of Java 1.6.
Is that correct?

Re: Jenkins: what Java versions are available for building with Maven?

Posted by Hervé BOUTEMY <he...@free.fr>.
switch to JDK 6 was done for 3.2
see the reference http://maven.apache.org/docs/history.html

and even if Maven requires JDK 6, you can use toolchains or animal sniffer to 
compile for Java 5:
- toolchains'logic is to compile with JDK 5, even if Maven uses a JDK 6,
- animal sniffers' logic is to compile with the JDK that runs Maven with -
target 1.5 then to check/sniff that only JDK 5 API is used

Regards,

Hervé

Le jeudi 8 janvier 2015 12:09:02 Andreas Lehmkühler a écrit :
> Hi,
> 
> > sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
> > 
> > 
> > I have been trying to test Commons Math build on Jenkins.
> > 
> > It runs fine if I choose Java 1.6 latest, however Math currently targets
> > 1.5.
> > 
> > If I try building using Java 1.5, Jenkins complains about class file
> > incompatibility.
> > 
> > So it looks like Jenkins needs a minimum of Java 1.6.
> > Is that correct?
> 
> I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about the
> excact version) somehow need a minimum of Java 1.6.
> 
> 
> BR
> Andreas Lehmkühler


Re: Jenkins: what Java versions are available for building with Maven?

Posted by sebb <se...@gmail.com>.
On 9 January 2015 at 00:32, Andrew Bayer <an...@gmail.com> wrote:
> The only way they'd ever move is if /home/jenkins became something else -
> in which case we'd have to rebuild all the packages to use the new path
> anyway. I'd say the odds of the paths ever changing from this point onward
> is slim to nil.
>
> I'll consider the settings.xml stuff, but I'd like to keep settings.xml as
> simple as we can when there are other viable options - i.e., you can use
> the Jenkins ToolEnv plugin to choose one of the Javas Jenkins knows about
> and have its location exported into your build environment.

I see. Easy enough to use in shell scripts.

Also possible to use for Maven.
For example:

[enable JDK_1_5_LATEST__HOME]

mvn compile -Pjava-1.5 -DJAVA_1_5_HOME=$JDK_1_5_LATEST__HOME

Thanks for the info.

> A.
>
> On Thu, Jan 8, 2015 at 4:15 PM, sebb <se...@gmail.com> wrote:
>
>> On 8 January 2015 at 19:10, Andrew Bayer <an...@gmail.com> wrote:
>> > Yeah, we're moving to installing via puppet all the legacy JDKs etc in
>> > /home/jenkins/tools from packages, so there is good reason to assume
>> > they'll always be there. =)
>>
>> That's good news.
>> Will they always be at the same path?
>>
>> If not (or even if so) would it be possible to define properties in
>> Maven host-global settings.xml that point to the home directories?
>>
>> Commons Parent uses the convention that
>>
>> JAVA_1_5_HOME
>>
>> points to the home directory of Java 1.5
>>
>> similarly for other Java versions.
>>
>> These are then used in profiles - e.g. java-1.5 - which override the
>> java compiler and runtime for compilation and testing.
>> The variables are also excluded from OSGI builds.
>> To avoid cluttering the name-space, the variable is only defined if
>> the profile is selected.
>>
>> For example:
>>
>>     <profile>
>>       <id>java-1.5</id>
>>       <properties>
>>         <JAVA_1_5_HOME>${env.JAVA150_HOME}</JAVA_1_5_HOME>
>>       </properties>
>>     </profile>
>>     <profile>
>>       <id>java-1.6</id>
>>       <properties>
>>         <JAVA_1_6_HOME>${env.JAVA160_HOME}</JAVA_1_6_HOME>
>>       </properties>
>>     </profile>
>>
>> The above assumes that the relevant environment variables have been
>> set, however that is not necessary; the paths can be listed directly,
>> for example:
>>
>>         <JAVA_1_5_HOME>/home/jenkins/tools/java/latest1.5</JAVA_1_5_HOME>
>>
>> Would this be possible?
>>
>> > A.
>> >
>> > On Thu, Jan 8, 2015 at 3:20 AM, sebb <se...@gmail.com> wrote:
>> >
>> >> On 8 January 2015 at 11:09, Andreas Lehmkühler <an...@lehmi.de>
>> wrote:
>> >> > Hi,
>> >> >
>> >> >> sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
>> >> >>
>> >> >>
>> >> >> I have been trying to test Commons Math build on Jenkins.
>> >> >>
>> >> >> It runs fine if I choose Java 1.6 latest, however Math currently
>> >> targets 1.5.
>> >> >>
>> >> >> If I try building using Java 1.5, Jenkins complains about class file
>> >> >> incompatibility.
>> >> >>
>> >> >> So it looks like Jenkins needs a minimum of Java 1.6.
>> >> >> Is that correct?
>> >> > I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about
>> >> the
>> >> > excact version) somehow need a minimum of Java 1.6.
>> >> >
>> >>
>> >> Thanks!
>> >>
>> >> I've looked again at the stack trace, and you're correct - it's Maven
>> >> that is complaining.
>> >>
>> >> Meanwhile I've found a way round the issue for Commons projects:
>> >>
>> >> -Pjava-1.5 -DJAVA_1_5_HOME=/home/jenkins/tools/java/latest1.5
>> >>
>> >> [The java-1.5 profile sets the java version for compile and test
>> >> assuming that JAVA_1_5_HOME is set appropriatel]
>> >>
>> >> So long as 1.5 is always at that location we should be good.
>> >>
>> >> >
>> >> > BR
>> >> > Andreas Lehmkühler
>> >>
>>

Re: Jenkins: what Java versions are available for building with Maven?

Posted by Andrew Bayer <an...@gmail.com>.
The only way they'd ever move is if /home/jenkins became something else -
in which case we'd have to rebuild all the packages to use the new path
anyway. I'd say the odds of the paths ever changing from this point onward
is slim to nil.

I'll consider the settings.xml stuff, but I'd like to keep settings.xml as
simple as we can when there are other viable options - i.e., you can use
the Jenkins ToolEnv plugin to choose one of the Javas Jenkins knows about
and have its location exported into your build environment.

A.

On Thu, Jan 8, 2015 at 4:15 PM, sebb <se...@gmail.com> wrote:

> On 8 January 2015 at 19:10, Andrew Bayer <an...@gmail.com> wrote:
> > Yeah, we're moving to installing via puppet all the legacy JDKs etc in
> > /home/jenkins/tools from packages, so there is good reason to assume
> > they'll always be there. =)
>
> That's good news.
> Will they always be at the same path?
>
> If not (or even if so) would it be possible to define properties in
> Maven host-global settings.xml that point to the home directories?
>
> Commons Parent uses the convention that
>
> JAVA_1_5_HOME
>
> points to the home directory of Java 1.5
>
> similarly for other Java versions.
>
> These are then used in profiles - e.g. java-1.5 - which override the
> java compiler and runtime for compilation and testing.
> The variables are also excluded from OSGI builds.
> To avoid cluttering the name-space, the variable is only defined if
> the profile is selected.
>
> For example:
>
>     <profile>
>       <id>java-1.5</id>
>       <properties>
>         <JAVA_1_5_HOME>${env.JAVA150_HOME}</JAVA_1_5_HOME>
>       </properties>
>     </profile>
>     <profile>
>       <id>java-1.6</id>
>       <properties>
>         <JAVA_1_6_HOME>${env.JAVA160_HOME}</JAVA_1_6_HOME>
>       </properties>
>     </profile>
>
> The above assumes that the relevant environment variables have been
> set, however that is not necessary; the paths can be listed directly,
> for example:
>
>         <JAVA_1_5_HOME>/home/jenkins/tools/java/latest1.5</JAVA_1_5_HOME>
>
> Would this be possible?
>
> > A.
> >
> > On Thu, Jan 8, 2015 at 3:20 AM, sebb <se...@gmail.com> wrote:
> >
> >> On 8 January 2015 at 11:09, Andreas Lehmkühler <an...@lehmi.de>
> wrote:
> >> > Hi,
> >> >
> >> >> sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
> >> >>
> >> >>
> >> >> I have been trying to test Commons Math build on Jenkins.
> >> >>
> >> >> It runs fine if I choose Java 1.6 latest, however Math currently
> >> targets 1.5.
> >> >>
> >> >> If I try building using Java 1.5, Jenkins complains about class file
> >> >> incompatibility.
> >> >>
> >> >> So it looks like Jenkins needs a minimum of Java 1.6.
> >> >> Is that correct?
> >> > I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about
> >> the
> >> > excact version) somehow need a minimum of Java 1.6.
> >> >
> >>
> >> Thanks!
> >>
> >> I've looked again at the stack trace, and you're correct - it's Maven
> >> that is complaining.
> >>
> >> Meanwhile I've found a way round the issue for Commons projects:
> >>
> >> -Pjava-1.5 -DJAVA_1_5_HOME=/home/jenkins/tools/java/latest1.5
> >>
> >> [The java-1.5 profile sets the java version for compile and test
> >> assuming that JAVA_1_5_HOME is set appropriatel]
> >>
> >> So long as 1.5 is always at that location we should be good.
> >>
> >> >
> >> > BR
> >> > Andreas Lehmkühler
> >>
>

Re: Jenkins: what Java versions are available for building with Maven?

Posted by sebb <se...@gmail.com>.
On 8 January 2015 at 19:10, Andrew Bayer <an...@gmail.com> wrote:
> Yeah, we're moving to installing via puppet all the legacy JDKs etc in
> /home/jenkins/tools from packages, so there is good reason to assume
> they'll always be there. =)

That's good news.
Will they always be at the same path?

If not (or even if so) would it be possible to define properties in
Maven host-global settings.xml that point to the home directories?

Commons Parent uses the convention that

JAVA_1_5_HOME

points to the home directory of Java 1.5

similarly for other Java versions.

These are then used in profiles - e.g. java-1.5 - which override the
java compiler and runtime for compilation and testing.
The variables are also excluded from OSGI builds.
To avoid cluttering the name-space, the variable is only defined if
the profile is selected.

For example:

    <profile>
      <id>java-1.5</id>
      <properties>
        <JAVA_1_5_HOME>${env.JAVA150_HOME}</JAVA_1_5_HOME>
      </properties>
    </profile>
    <profile>
      <id>java-1.6</id>
      <properties>
        <JAVA_1_6_HOME>${env.JAVA160_HOME}</JAVA_1_6_HOME>
      </properties>
    </profile>

The above assumes that the relevant environment variables have been
set, however that is not necessary; the paths can be listed directly,
for example:

        <JAVA_1_5_HOME>/home/jenkins/tools/java/latest1.5</JAVA_1_5_HOME>

Would this be possible?

> A.
>
> On Thu, Jan 8, 2015 at 3:20 AM, sebb <se...@gmail.com> wrote:
>
>> On 8 January 2015 at 11:09, Andreas Lehmkühler <an...@lehmi.de> wrote:
>> > Hi,
>> >
>> >> sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
>> >>
>> >>
>> >> I have been trying to test Commons Math build on Jenkins.
>> >>
>> >> It runs fine if I choose Java 1.6 latest, however Math currently
>> targets 1.5.
>> >>
>> >> If I try building using Java 1.5, Jenkins complains about class file
>> >> incompatibility.
>> >>
>> >> So it looks like Jenkins needs a minimum of Java 1.6.
>> >> Is that correct?
>> > I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about
>> the
>> > excact version) somehow need a minimum of Java 1.6.
>> >
>>
>> Thanks!
>>
>> I've looked again at the stack trace, and you're correct - it's Maven
>> that is complaining.
>>
>> Meanwhile I've found a way round the issue for Commons projects:
>>
>> -Pjava-1.5 -DJAVA_1_5_HOME=/home/jenkins/tools/java/latest1.5
>>
>> [The java-1.5 profile sets the java version for compile and test
>> assuming that JAVA_1_5_HOME is set appropriatel]
>>
>> So long as 1.5 is always at that location we should be good.
>>
>> >
>> > BR
>> > Andreas Lehmkühler
>>

Re: Jenkins: what Java versions are available for building with Maven?

Posted by Andrew Bayer <an...@gmail.com>.
Yeah, we're moving to installing via puppet all the legacy JDKs etc in
/home/jenkins/tools from packages, so there is good reason to assume
they'll always be there. =)

A.

On Thu, Jan 8, 2015 at 3:20 AM, sebb <se...@gmail.com> wrote:

> On 8 January 2015 at 11:09, Andreas Lehmkühler <an...@lehmi.de> wrote:
> > Hi,
> >
> >> sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
> >>
> >>
> >> I have been trying to test Commons Math build on Jenkins.
> >>
> >> It runs fine if I choose Java 1.6 latest, however Math currently
> targets 1.5.
> >>
> >> If I try building using Java 1.5, Jenkins complains about class file
> >> incompatibility.
> >>
> >> So it looks like Jenkins needs a minimum of Java 1.6.
> >> Is that correct?
> > I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about
> the
> > excact version) somehow need a minimum of Java 1.6.
> >
>
> Thanks!
>
> I've looked again at the stack trace, and you're correct - it's Maven
> that is complaining.
>
> Meanwhile I've found a way round the issue for Commons projects:
>
> -Pjava-1.5 -DJAVA_1_5_HOME=/home/jenkins/tools/java/latest1.5
>
> [The java-1.5 profile sets the java version for compile and test
> assuming that JAVA_1_5_HOME is set appropriatel]
>
> So long as 1.5 is always at that location we should be good.
>
> >
> > BR
> > Andreas Lehmkühler
>

Re: Jenkins: what Java versions are available for building with Maven?

Posted by sebb <se...@gmail.com>.
On 8 January 2015 at 11:09, Andreas Lehmkühler <an...@lehmi.de> wrote:
> Hi,
>
>> sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
>>
>>
>> I have been trying to test Commons Math build on Jenkins.
>>
>> It runs fine if I choose Java 1.6 latest, however Math currently targets 1.5.
>>
>> If I try building using Java 1.5, Jenkins complains about class file
>> incompatibility.
>>
>> So it looks like Jenkins needs a minimum of Java 1.6.
>> Is that correct?
> I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about the
> excact version) somehow need a minimum of Java 1.6.
>

Thanks!

I've looked again at the stack trace, and you're correct - it's Maven
that is complaining.

Meanwhile I've found a way round the issue for Commons projects:

-Pjava-1.5 -DJAVA_1_5_HOME=/home/jenkins/tools/java/latest1.5

[The java-1.5 profile sets the java version for compile and test
assuming that JAVA_1_5_HOME is set appropriatel]

So long as 1.5 is always at that location we should be good.

>
> BR
> Andreas Lehmkühler

Re: Jenkins: what Java versions are available for building with Maven?

Posted by Andreas Lehmkühler <an...@lehmi.de>.
Hi,

> sebb <se...@gmail.com> hat am 8. Januar 2015 um 11:05 geschrieben:
> 
> 
> I have been trying to test Commons Math build on Jenkins.
> 
> It runs fine if I choose Java 1.6 latest, however Math currently targets 1.5.
> 
> If I try building using Java 1.5, Jenkins complains about class file
> incompatibility.
> 
> So it looks like Jenkins needs a minimum of Java 1.6.
> Is that correct?
I guess the issue is maven, newer versions (> 3.0.3 I'm not sure about the
excact version) somehow need a minimum of Java 1.6.


BR
Andreas Lehmkühler