timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-28120] Jenkins core to require Java7 #7169

Closed timja closed 8 years ago

timja commented 9 years ago

This ticket tracks the promise made in http://jenkins-ci.org/content/good-bye-java6 that we are bumping up core requirements from Java6 to Java7.


Originally reported by kohsuke, imported from: Jenkins core to require Java7
  • assignee: kohsuke
  • status: Resolved
  • priority: Major
  • resolution: Fixed
  • resolved: 2015-08-11T22:50:51+00:00
  • imported: 2022/01/10
timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
changelog.html
core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly
pom.xml
http://jenkins-ci.org/commit/jenkins/2826ea3185f5ca1df02ab54d465a14308ecffe05
Log:
JENKINS-28120

As the first step of Java7 migration, ship Java7 class files without
requiring Java7 runtime.

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
changelog.html
core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly
pom.xml
http://jenkins-ci.org/commit/jenkins/de8bba40cf593bec5fda197e09f644ae53e207a3
Log:
JENKINS-28120

As the first step of Java7 migration, ship Java7 class files without
requiring Java7 runtime.

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
src/main/java/Main.java
http://jenkins-ci.org/commit/extras-executable-war/9850770999541aff2e44e5695737a452892666d1
Log:
JENKINS-28120

Now requiring Java7

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
pom.xml
war/pom.xml
http://jenkins-ci.org/commit/jenkins/18fa9363c2df5deba4a64e0b44d6417b324049ad
Log:
JENKINS-28120

Reflecting more code review comments from
https://github.com/jenkinsci/jenkins/pull/1679

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
core/pom.xml
pom.xml
war/pom.xml
http://jenkins-ci.org/commit/jenkins/c00935f0b212272c7b00dc446bdbab20a13bb787
Log:
JENKINS-28120

Reflecting more code review comments from
https://github.com/jenkinsci/jenkins/pull/1679

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
changelog.html
core/pom.xml
core/src/main/resources/hudson/slaves/SlaveComputer/slave-agent.jnlp.jelly
pom.xml
war/pom.xml
http://jenkins-ci.org/commit/jenkins/e75bea8928a904c5a2de47f3ee54ae726b12f4af
Log:
[FIXED JENKINS-28120] Merge pull request #1679

Compare: https://github.com/jenkinsci/jenkins/compare/ca3b1db4d6f7...e75bea8928a9

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
pom.xml
http://jenkins-ci.org/commit/jenkins/8d3cd91e281861ac9e28f60a39cb7d131e1911f6
Log:
Follow up fix to JENKINS-28120.

timja commented 9 years ago

jgeertsma:

I have installed 1.612 but it broke one build, so I reverted to 1.611

Our Jenkins uses Java 1.8, the slave uses 1.7, but the broken build is a Maven project that depends on Java 1.6. In the job configuration the JDK is set to 1.6 and I tried the optional maven parameter -Dmaven.compiler.executable=/opt/java/jdk-1.6/bin/javac. In 1.612 I get a line in the console output which says "JENKINS-18403] JDK 5 not supported to run Maven" ... but I didn't specify JDK5, also restarting the build slaves didn't help.

I applaud the upgrade to Java7 and I would like to upgrade our projects to Java7 or Java8, but some legacy code makes it complicated.

07:23:55 [BuildJob] $ /opt/java/jdk-1.6/bin/java -cp /opt/data/jenkins-agent/maven32-agent.jar:/opt/maven/apache-maven-3/boot/plexus-classworlds-2.5.1.jar:/opt/maven/apache-maven-3/conf/logging jenkins.maven3.agent.Maven32Main /opt/maven/apache-maven-3 /opt/data/jenkins-agent/slave.jar /opt/data/jenkins-agent/maven32-interceptor.jar /opt/data/jenkins-agent/maven3-interceptor-commons.jar 46882
07:23:56 <===[JENKINS REMOTING CAPACITY]===>channel started
07:23:56 ERROR: [JENKINS-18403] JDK 5 not supported to run Maven; retrying with slave Java and setting compile/test properties to point to /opt/java/jdk-1.6
07:23:56 maven32-agent.jar already up to date
07:23:56 maven32-interceptor.jar already up to date
07:23:56 maven3-interceptor-commons.jar already up to date
07:23:56 [BuildJob] $ /opt/java/jdk1.7.0_72/jre/bin/java -cp /opt/data/jenkins-agent/maven32-agent.jar:/opt/maven/apache-maven-3/boot/plexus-classworlds-2.5.1.jar:/opt/maven/apache-maven-3/conf/logging

EDIT: Thanks Jesse, it took me a while before I released the meaning of JDK in the project. I know understand you referred to "JDK to be used for this project". You're right and my project builds fine when I set this to JDK-7 or JDK-8 ... My problem was
07:23:55 [BuildJob] $ /opt/java/jdk-1.6/bin/java
And it is now solved, thanks for the quick and precise feedback!

timja commented 9 years ago

jglick:

jgeertsma see JENKINS-25272. You must now set the job configuration to JDK 7 or higher. The message is just out of date; what is not supported to run Maven is any version of Java older than what the Jenkins master itself requires.

timja commented 9 years ago

piepera:

After upgrading to Jenkins 1.612, we can no longer build Java 1.6 Maven projects. We get this "JENKINS-18403 JDK 5 not supported...." error, followed by compilation errors related to API changes from Java 1.6 to Java 1.7.

If I understand the discussion in JENKINS-25272 correctly, this is deliberate behavior. Jenkins will no longer allow us to have multiple maven projects which build using different JDKs. There are two workarounds: either upgrade all of our projects to Java 1.7, or stop using the Maven Project Type, using a Freestyle project type with Maven Build Step instead.

Is this understanding correct? Does Jenkins 1.612 no longer support the building of Java 1.6 Maven projects? If so, we will probably just continue using older versions of Jenkins for the foreseeable future.

timja commented 9 years ago

jglick:

If you wish to use the Maven project type, you must set the Jenkins project configuration to use JDK 7 or newer, which means the JVM used to run Maven itself. The JDK tools used to build and test your project’s code may be anything. These tools are defined by settings in Maven plugins, such as -Dmaven.compiler.executable=… on the Maven command line.

Alternately, you can simply build your project using JDK 7+ tools but using tool configuration limiting the source code to earlier releases (such as -source 6), and using the Animal Sniffer plugin to block Java 7+ APIs from being used accidentally.

If you wish to run the Maven process using anything older than Java 7, you must use the freestyle project type with the Maven build step—which I would strongly recommend for a variety of reasons anyway.

timja commented 9 years ago

raspy:

We have some older slaves which run SunOS-5.9 for which Oracle does not provide Java7. Slave upgrade is not a solution either since there are some native legacy tools used in the build system which can only run on this machine. Does this mean I will have to stop upgrading Jenkins in order to have SunOS-5.9 slaves connected?

timja commented 9 years ago

jglick:

Does this mean I will have to stop upgrading Jenkins in order to have SunOS-5.9 slaves connected?

Sounds that way, unless you can find an OpenJDK 7 port.

timja commented 9 years ago

victornoel:

Jesse, why would you strongly recommend to use the freestyle project type for Maven builds?

I tried to look at it but there is two different build step available: invoke maven3 and invoke maven goal (or something like that, I am not using the english locale).
Which one should then be used?
And are dependencies taken into account to trigger the jobs as with the maven project type?
Is there specific to do w.r.t. to the tests and the unstability of the build?

Thank you for your help

timja commented 9 years ago

scm_issue_link:

Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
pom.xml
http://jenkins-ci.org/commit/jenkins/6496a946848204dc908c503452fc294c7daebb73
Log:
JENKINS-28120 Phase 2: allow the core to use Java7 syntax and runtime.

timja commented 9 years ago

dogfood:

Integrated in jenkins_main_trunk #4155
JENKINS-28120 Phase 2: allow the core to use Java7 syntax and runtime. (Revision 6496a946848204dc908c503452fc294c7daebb73)

Result = UNSTABLE
kohsuke : 6496a946848204dc908c503452fc294c7daebb73
Files :

timja commented 8 years ago

scm_issue_link:

Code changed in jenkins
User: Mitoma Ryo
Path:
src/main/java/hudson/plugins/sshslaves/SSHLauncher.java
http://jenkins-ci.org/commit/ssh-slaves-plugin/af2b72bd79577550623be685158bd2969284cff0
Log:
update JDK version.

Jenkins became requiring JDK1.7.
see JENKINS-28120 https://github.com/jenkinsci/jenkins/commit/c00935f0b212272c7b00dc446bdbab20a13bb787

timja commented 8 years ago

jglick:

victornoel this is a user list question which is off topic here.

timja commented 8 years ago

plsuh:

OS X installer is broken due to this issue. See bug #28438. In addition, Apple has added an updated download link to the Java 6 dependency, https://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US.

timja commented 8 years ago

jglick:

plsuh if you know of any regressions caused by this please make sure they are filed separately and marked as blocking this one. Do not reopen.

timja commented 2 years ago

[Originally duplicated by: JENKINS-28197]

timja commented 2 years ago

[Originally duplicated by: JENKINS-27623]

timja commented 2 years ago

[Originally depends on: JENKINS-28438]

timja commented 2 years ago

[Originally depends on: JENKINS-28231]