gitblit-org / gitblit

pure java git solution
http://gitblit.com
Apache License 2.0
2.27k stars 671 forks source link

JDK requirement: minimum JKD 7u171 is required to allow build process, but this is available only under support policy. #1386

Closed TomaszSzt closed 2 years ago

TomaszSzt commented 2 years ago

Unable to build with JDK 1.7

Since GITBLIT requires Java 7 I did installed first of JDK 7 lines I had on hand, all with JRE and everything. The versions I had were 1.7.0_02 and 1.7.0_80. Since the last Java 7 compatible version of ANT is 1.9 I also did set it up.

Then moxie build scripts failed with: (...) [mx:init] downloading prefixes index for .meta/prefixes.txt [mx:init] opening https://repo1.maven.org/maven2 (DIRECT) (...) Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)

According to

https://github.com/jvm-bloggers/jvm-bloggers/issues/334 and https://www.oracle.com/java/technologies/downloads/archive/

this is due to weak SSL layer n JDK 7 prior to 7u171.

The tricky part is that https://www.oracle.com/java/technologies/javase/javase7-archive-downloads.html support up to u80 version only. Open JDK offers only one build for Windows which is also too old.

I could not find a 1.7 version which could connect and download necessary dependencies from github.

Since ORACLE is tightening grip on JAVA what is practically left are leading edge versions or old pre paid-support era releases. Gladly my 1.8.0_301 works, while 1.8.0_131 does NOT work.

It seems that what is needed is either a paid 1.7 support version, switch to 1.8 or set a MIXED environment in which JRE which is running ANT comes from comes from at least 1.7.171 / 1.8.161 / 1.9.148 and JDK comes from 1.7. It may be tricky to set up, but it is possible after some struggling.

I do not consider it to be a bug. Just rotting. I suppose moving up the version ladder to something not such old is recommended.

flaix commented 2 years ago

Gitblit does not require Java 7. It defines the minimum version as Java 7, which means that the source code must not use Java 8 constructs, and that the binaries are defined to run on Java 7. This way it can run on Java 7 machines. But it will just as well run on Java 8 or Java 11. (Not on Java 16, currently, at least not without a workaround.)

Gitblit can also be built with a JDK other than 7. Again, only the language and binary level are fixed at Java 7, but it is built, e.g. on Github, with JDK7, JDK8 and JDK11.

Forget Oracle. If you don't need their support or extras for your enterprise needs, get the JDK from somewhere else. Oracle plays no role in Java distribution for normal use anymore. I use Zulu for my JDK7 and AdoptOpenJDK, now Adoptium, for JDK8 and JDK11. They all build Gitblit with moxie without problems.

That being said, 1.9.2 will be the last version upholding Java 7 as the minimum. The following version 1.10.0 will require Java 8 as the minimum version. Not for build requirements, but because dependencies now require at least Java 8. Which is only fair enough.

TomaszSzt commented 2 years ago

Fine, I do understand. I will close this bug report. It was there here just to help anyone who will hit the same problem as I did. No action is required.

I agree it can be built with other tools. However the fact that 7 is the minimum rather enforces to not only use pre 8 language constructs and pre 8 class file version but also a complete jdk7 class set.

It is relatively easy to, by mistake, use classes or methods from above jdk 7 when compiling with higher end tool chain. This easy to, by mistake, test code against incorrect JDK with automated test scripts. So it was much, much easier for me to just switch the entire tool chain to proper JDK version.

I also remember that when I tried 1.8.0 on Java 9 on Linux it just barfed and died, but honestly, I did not care about it, just downgraded to Java 8. It might be my wrong then.

As using other JDK.... well... I need stability and proof of it. When I test against JDK/JRE in version X then this is the required, supported version. I do not have time and resources, as You guys possibly also do not have, to test against may different JDK/JRE versions with possibly different patch-sets, different C compiler version and optimizations used to build it and etc.

Also I could not find JDK 7 with high enough version from any other source than Oracle. Could You point me to somewhere?

I am always a bit pissed off when "changing it to better" (like enforcing stronger SSL on servers) breaks something what worked well.

Where is 1.10.0 source? I can't see any branch dedicated to it. I did pulled master and it reports 1.9.2-snapshot, so this is rather not the right place.

flaix commented 2 years ago

Since the language and binary level are set to Java7, the compiler, or IDE, or whatever you use, should complain when incompatible constructs are used, no matter what your underlying JDK is for compiling.

I am using Java 7 from Azul. This is what my IDE has set as base for the project. On the command line I usually build and run with Java8 or 11.

There is no dedicated branch for version 1.10. It is just the milestone on the roadmap, after the next 1.9.2 release.