Currently in my jenkins setup I have 1 master and 2 nodes.
One node has jdk 7 and another node has jdk8. Now I want to execute pipelines under jdk8 but not under jdk7 as I have migrated the application from jdk7 to 8.
If I run the pipelines only on the node where jdk8 is installed will work??
OR do I need to do the changes in the pipeline as such as adding new jdk8 version as env variable in the package stage in the pipeline?
just I want to compile the code under jdk8 instead of 7 in jenkins?
Related
I would like to use Amazon Lambda to run a component. However, this component has dependencies with some packages which seem to be only available in the Oracle's SDK.
I have read that AWS Lambda functions run on Linux Amazon AMI (which are Open SDK based). Actually, some time ago I tried to run my project on an EC2 instance and faced the same problem, so I switched to a standard Ubuntu 14.04 and I installed the Oracle Java 8 SDK.
Do you have any ideas?
Edit: the problem I'm finding is:
[2016-11-21T23:58:02.100] java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager
[2016-11-21T23:58:02.100] java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager
[2016-11-21T23:58:02.100] at com.machinepublishers.jbrowserdriver.JBrowserDriverServer.main(JBrowserDriverServer.java:74)
I think that class is only available in the Oracle's Java SDK.
If you check Lambda Execution Environment and Available Libraries, then you will get
If you are using any native binaries in your code, make sure they are
compiled in this environment. Note that only 64-bit binaries are
supported on AWS Lambda.
AWS Lambda supports the following runtime versions:
Node.js – v0.10.36, v4.3.2 (recommended)
Java – Java 8
Python – Python 2.7
Q: What is the JVM environment Lambda uses for execution of my function?
Ans: Lambda provides the Amazon Linux build of openjdk 1.8.
Q: How do I compile my AWS Lambda function Java code?
You can use standard tools like Maven or Gradle to compile your Lambda
function. Your build process should mimic the same build process you
would use to compile any Java code that depends on the AWS SDK. Run
your Java compiler tool on your source files and include the AWS SDK
1.9 or later with transitive dependencies on your classpath. For more details, see aws documentation.
You can also check: AWS Lambda: How It Works
UPDATE:
If you check the github for jbrowserdriver, the pre-requisite are given
Prerequisites
Java 8 with JavaFX:
Ubuntu Xenial 16.04 LTS, Debian 8 Jessie (Backports), Debian 9
Stretch:
sudo apt-get install openjdk-8-jre openjfx
Ubuntu Trusty 14.04 LTS:
sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update && sudo apt-get install oracle-java8-installer libgtk2.0 libxtst6 libxslt1.1 fonts-freefont-ttf libasound2 && sudo update-alternatives --config java
Mac, Windows, Linux:
install Oracle Java 8 (note: choose either the JRE or JDK but not the "Server JRE" since it doesn't include JavaFX)
Resource Link:
https://aws.amazon.com/lambda/faqs/#functions-java
When I try to run my Jenkins Maven job I get the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project myProject: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
This indicates that Maven uses Java 1.8 but it is supposed to use Java 1.7.
I ran Maven in debug mode and it displayed the right versions:
...
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven305
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: /var/lib/jenkins/tools/hudson.model.JDK/JDK_7u71/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-44-generic", arch: "amd64", family: "unix"
...
The Jenkins server runs with Java 1.8
...
$ java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
...
$ javac -version
javac 1.8.0_74
...
I tried running the job with an empty Maven repo and telling Maven exactly which version to use but with no success.
I call Maven like this:
mvn clean install -X -DskipTests -Dmaven.repo.local=../testrepo -Djava.version=1.7
Am I doing something wrong?
Proper solution is to add needed JDK to Jenkins global configuration and then to specifically choose needed JDK version/installation under the project build configuration.
Start by copying needed JDKs to your build machine. Then open Jenkins configuration and scroll to "JDK" section [Jenkins -> Manage Jenkins -> Configure System]. Add desired JDKs to Jenkins. Following picture is example of Jenkins configured with two different JDKs.
Now under project configuration [YourProject -> Configure], a new option will be available. You can select desired JDK to build project with as in the picture:
"(Default)" JVM in picture refers to the JDK under which Jenkins run. Easy fix would be to change this JDK to the version needed for your project (either by changing Jenkins start script or using JAVA_HOME). This will work. However once you have a need to build two or more conflicting projects, you are gonna need to configure multiple JDKs anyway.
By using similar steps you can add multiple maven installations to your Jenkins server.
In Jenkins 2.7.3 (and later on maybe) the menu navigation is slightly different:
1) Manage Jenkins
2) Global Tool Configuration
3) JDK section
4) press "JDK installations" button
5) JDK options and paths are there
Try the following steps:
1) Go to Manage Jenkins -> Configure system
2) Add JAVA_HOME and its path in Global Properties -> Environment Variables
3) Add JDK and path in JDK section
If not, try following this post as a lot of solutions are offered here: Maven uses an incorrect Java version when it is executed by Jenkins
I finally found out what the problem was.
I use another module in my build which I download from a nexus server. Someone made a mistake and uploaded a version to the nexus which is out of sync with the one under version control. The version on nexus has Java 1.8 specified but the one under version control has Java 1.7 so I did not notice it earlier.
Thanks everyone for the great answers.
From Jenkins 2.60.1 (June 2017) LTS on, maven jobs require JDK 1.8 or up.
Only maven jobs require this, all the rest (for example freestyle ones) can fix the jdk version that fit their needs best.
See LTS Changelog:
2.60.1 is the first Jenkins LTS release that requires Java 8 to run. If you're using the Maven Project type, please note that it needs to
use a JDK capable of running Jenkins, i.e. JDK 8 or up. If you
configure an older JDK in a Maven Project, Jenkins will attempt to
find a newer JDK and use that automatically.
Compatibility Notes
Using the Maven project type with Java 7
Users with jobs configured with the "Maven project" type may not be
able to use Java 7 for their Maven jobs. The correct behavior is not
guaranteed so proceed at your own risk. The Maven Project uses Jenkins
Remoting to establish "interceptors" within the Maven executable.
Because of this, Maven uses Remoting and other Jenkins core classes,
and this behavior may break an update.
i'm new to storm ,zookeeper and java
Now i imported project using storm -0.8.2 with recommended maven -3.X
but i don't know what is the version of zookeeper and version of maven that i should install it !!?
and i installed java 7
java -version
java version "1.7.0_80"
is there problem with using another version of java that coder used another ?
or is there any problem of using java 7 with old version of storm ?
There is no problems to use Java 7 with storm 0.8.2 as I done it. But stay away from zookeeper 3.3.3. Try zookeeper 3.3.5 or higher since the 3.3.3 caused storm workers to hang, crash or stop after 4-5 hours.
As for maven, Maven 3.3 will work fine to build jar compatible with storm.
I am trying to run elasticsearch 1.6.0 using cygwin on a 64-bit Windows 7 machine. I downloaded the elasticsearch zip from the elasticsearch home page, and installed the latest version of java and jdk (1.8.0_45) and have set the JAVA_HOME variable to the right path I think. When I try to execute the very first step in the Definitive Guide installation process:
$ ./bin/plugin -i elasticsearch/marvel/latest
I get this error:
Error: Could not find or load main class org.elasticsearch.plugins.PluginManager
I've seen this problem with earlier versions of elastic, but apparently the problem was fixed so I'm not sure why this is happening.
I have interesting issue. Using Jenkins build master on Linux, and having one Mac Mountain Lion node (the thing described here works fine on Linuxes and Windows, but having problem only on this Mac machine, using both SSH connection and Java Web Start.
On client machine:
I have installed JDK (and verified it).
I set JAVA_HOME trough .profile for build user used for communication with Jenkins
Java is accessible from shell, as well as Maven
but Jenkins always set another JAVA_HOME after starting the job ($JENKINS_HOME/tools/JDK/jdk1.6) but that folder is empty (on Linux nodes, inside this folder JDK should be deployed, and is, but not on Mac).
Does anyone know is it possible at all to change this behavior in Jenkins? Neither setting custom JAVA_HOME in Jenkins configuration didn't help, playing with .profile file, exporting variables on the fly in jobs, etc.
I'm using latest version 1.477
Update & fix August 15th 2012
So, there's one line when running the job on Mac, saying
JDK installation skipped: Unknown CPU name: mac os x
The point is that Oracle don't release JDK for Mac and this is kind of 'feature'.
Steps I did to fix this were:
Configured SSH connection between Jenkins and Mac node
Installed JDK manually to Mac
Added to node configuration Java as a tool and specified path to JDK home on Mac node
REMOVED Maven as tool from node configuration (as it's exported from Lion version already on the node, and if you don't remove it, your Maven stuff is going to fail for whatever clash reason).
This fixed the things on both Lion and Mountain Lion.
So, there's one line when running the job on Mac, saying
JDK installation skipped: Unknown CPU name: mac os x
The point is that Oracle don't release JDK for Mac and this is kind of 'feature'.
Steps I did to fix this were:
Configured SSH connection between Jenkins and Mac node
Installed JDK manually to Mac
Added to node configuration Java as a tool and specified path to JDK home on Mac node
REMOVED Maven as tool from node configuration(as it's exported from Lion version already on the node, and if you don't remove it,your Maven stuff is going to fail for whatever clash reason).
This fixed the things on both Lion and Mountain Lion.