Problems with multiple java installations on a windows slave

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Problems with multiple java installations on a windows slave

Dünnebeil Gerhard

Hello everybody,

 

recently I started using slave builds with jenkins.

 

My configuration is Jenkins on a ubuntu (11.10) box and a slave with windows XP.

 

With that I ran into the following problem:

 

I have two versions of java (one jre and one jdk) installed on my windows machine. There are reasons I can’t stick with only one of them which are beyond this discussion.

 

Now when I run a maven job on this slave it chooses the jre as its java location. This is a problem for me as the build needs tools.jar and some other libs which are not found this way.

 

I tried to force the use of the JDK by setting JAVA_HOME, JRE_HOME and by manually setting the PATH to “” (empty).  Nothing helped.

I also set MAVEN_BATCH_ECHO=on which had no obvious result.

 

So I tried to debug maven by starting maven from a pre-start step (“mvn –v”).

The result was interesting as this maven instance reacted to MAVEN_BATCH_ECHO and showed the correct java instance.

 

So for me it seems that Jenkins somehow bypasses the maven batch (mvn.bat) and/or ignores the environment variables set.

 

Can somebody help me here?

 

Thanks

Gerhard Duennebeil

 

__________________________________________________

Gerhard Dünnebeil
Safety & Security Department
SIM


Bitte beachten Sie unseren neuen Firmennamen und neue Kontaktdaten!

Please note our new company name and contact details!
AIT Austrian Institute of Technology GmbH
2444 Seibersdorf | Austria
T +43(0) 50550-3173|  F +43(0) 50550-2813

[hidden email]  |  http://www.ait.ac.at

FN: 115980 i HG Wien  |  UID: ATU14703506
This email and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient, please notify the sender by return e-mail or by telephone and delete this message from your system and any printout thereof. Any unauthorized use, reproduction, or dissemination of this message is strictly prohibited. Please note that e-mails are susceptible to change. AIT Austrian Institute of Technology GmbH shall not be liable for the improper or incomplete transmission of the information contained in this communication, nor shall it be liable for any delay in its receipt.

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problems with multiple java installations on a windows slave

Sami Tikka
I don't really use Maven that much but I do build Jenkins from time to time.

Jenkins has at least two ways of doing a Maven build.

1) If you choose a "maven2/3 project" type when creating a job,
Jenkins will not call mvn.bat when building. Instead it will load
Maven classes and call them directly. I believe it will use the same
jvm as is used to run Jenkins itself. I.e. use the same jvm for
running Jenkins.

2) If you choose a freestyle project when creating a job, you can
freely specify the command to run your build and set any environment
variables the way you want. This would allow you to build your Maven
project with a different jvm than used to run Jenkins. You will lose
some things... you have to tell Jenkins where the test results are
found and where are the build artifact to archive.

-- Sami

2012/2/14 Dünnebeil Gerhard <[hidden email]>:

> Hello everybody,
>
>
>
> recently I started using slave builds with jenkins.
>
>
>
> My configuration is Jenkins on a ubuntu (11.10) box and a slave with windows
> XP.
>
>
>
> With that I ran into the following problem:
>
>
>
> I have two versions of java (one jre and one jdk) installed on my windows
> machine. There are reasons I can’t stick with only one of them which are
> beyond this discussion.
>
>
>
> Now when I run a maven job on this slave it chooses the jre as its java
> location. This is a problem for me as the build needs tools.jar and some
> other libs which are not found this way.
>
>
>
> I tried to force the use of the JDK by setting JAVA_HOME, JRE_HOME and by
> manually setting the PATH to “” (empty).  Nothing helped.
>
> I also set MAVEN_BATCH_ECHO=on which had no obvious result.
>
>
>
> So I tried to debug maven by starting maven from a pre-start step (“mvn
> –v”).
>
> The result was interesting as this maven instance reacted to
> MAVEN_BATCH_ECHO and showed the correct java instance.
>
>
>
> So for me it seems that Jenkins somehow bypasses the maven batch (mvn.bat)
> and/or ignores the environment variables set.
>
>
>
> Can somebody help me here?
>
>
>
> Thanks
>
> Gerhard Duennebeil
>
>
>
> __________________________________________________
>
> Gerhard Dünnebeil
> Safety & Security Department
> SIM
>
>
> Bitte beachten Sie unseren neuen Firmennamen und neue Kontaktdaten!
>
> Please note our new company name and contact details!
> AIT Austrian Institute of Technology GmbH
> 2444 Seibersdorf | Austria
> T +43(0) 50550-3173|  F +43(0) 50550-2813
>
> [hidden email]  |  http://www.ait.ac.at
>
> FN: 115980 i HG Wien  |  UID: ATU14703506
> This email and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please
> notify the sender by return e-mail or by telephone and delete this message
> from your system and any printout thereof. Any unauthorized use,
> reproduction, or dissemination of this message is strictly prohibited.
> Please note that e-mails are susceptible to change. AIT Austrian Institute
> of Technology GmbH shall not be liable for the improper or incomplete
> transmission of the information contained in this communication, nor shall
> it be liable for any delay in its receipt.
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problems with multiple java installations on a windows slave

vlatombe
Did you declare your JDK in Jenkins' global settings? If you have done so, you should be able to select for each job the JDK that you want to use.

Vincent


2012/2/22 Sami Tikka <[hidden email]>
I don't really use Maven that much but I do build Jenkins from time to time.

Jenkins has at least two ways of doing a Maven build.

1) If you choose a "maven2/3 project" type when creating a job,
Jenkins will not call mvn.bat when building. Instead it will load
Maven classes and call them directly. I believe it will use the same
jvm as is used to run Jenkins itself. I.e. use the same jvm for
running Jenkins.

2) If you choose a freestyle project when creating a job, you can
freely specify the command to run your build and set any environment
variables the way you want. This would allow you to build your Maven
project with a different jvm than used to run Jenkins. You will lose
some things... you have to tell Jenkins where the test results are
found and where are the build artifact to archive.

-- Sami

2012/2/14 Dünnebeil Gerhard <[hidden email]>:
> Hello everybody,
>
>
>
> recently I started using slave builds with jenkins.
>
>
>
> My configuration is Jenkins on a ubuntu (11.10) box and a slave with windows
> XP.
>
>
>
> With that I ran into the following problem:
>
>
>
> I have two versions of java (one jre and one jdk) installed on my windows
> machine. There are reasons I can’t stick with only one of them which are
> beyond this discussion.
>
>
>
> Now when I run a maven job on this slave it chooses the jre as its java
> location. This is a problem for me as the build needs tools.jar and some
> other libs which are not found this way.
>
>
>
> I tried to force the use of the JDK by setting JAVA_HOME, JRE_HOME and by
> manually setting the PATH to “” (empty).  Nothing helped.
>
> I also set MAVEN_BATCH_ECHO=on which had no obvious result.
>
>
>
> So I tried to debug maven by starting maven from a pre-start step (“mvn
> –v”).
>
> The result was interesting as this maven instance reacted to
> MAVEN_BATCH_ECHO and showed the correct java instance.
>
>
>
> So for me it seems that Jenkins somehow bypasses the maven batch (mvn.bat)
> and/or ignores the environment variables set.
>
>
>
> Can somebody help me here?
>
>
>
> Thanks
>
> Gerhard Duennebeil
>
>
>
> __________________________________________________
>
> Gerhard Dünnebeil
> Safety & Security Department
> SIM
>
>
> Bitte beachten Sie unseren neuen Firmennamen und neue Kontaktdaten!
>
> Please note our new company name and contact details!
> AIT Austrian Institute of Technology GmbH
> 2444 Seibersdorf | Austria
> T <a href="tel:%2B43%280%29%2050550-3173" value="+43505503173">+43(0) 50550-3173|  F <a href="tel:%2B43%280%29%2050550-2813" value="+43505502813">+43(0) 50550-2813
>
> [hidden email]  |  http://www.ait.ac.at
>
> FN: 115980 i HG Wien  |  UID: ATU14703506
> This email and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient, please
> notify the sender by return e-mail or by telephone and delete this message
> from your system and any printout thereof. Any unauthorized use,
> reproduction, or dissemination of this message is strictly prohibited.
> Please note that e-mails are susceptible to change. AIT Austrian Institute
> of Technology GmbH shall not be liable for the improper or incomplete
> transmission of the information contained in this communication, nor shall
> it be liable for any delay in its receipt.
>
>

Loading...