Opened 6 years ago
Closed 6 years ago
#58108 closed enhancement (fixed)
tomcat-native: JDK missing in Mojave images?
Reported by: | mattbishop (Matt Bishop) | Owned by: | admin@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | breun (Nils Breunese), cjones051073 (Chris Jones) | |
Port: | tomcat-native |
Description
MacOS used to include a JDK which was useful to ports that needed it. Mojave no longer has a JDK included, yet many java ports exist that need it. How should a port maintainer go about obtaining a JDK for Travis/Azure builds?
Change History (21)
comment:1 Changed 6 years ago by mf2k (Frank Schima)
Milestone: | MacPorts Future |
---|---|
Type: | request → enhancement |
comment:2 Changed 6 years ago by mf2k (Frank Schima)
Version: | 2.5.4 |
---|
comment:3 follow-up: 16 Changed 6 years ago by mf2k (Frank Schima)
I'm not sure that installing java on the buildbots is the solution here. What if the user does not have java installed? You need to account for that in the Portfile.
comment:4 Changed 6 years ago by mattbishop (Matt Bishop)
Good point. Hmm. Hmm. I see there is an openjdk8 port, I'll require that and get what I need that way.
comment:5 Changed 6 years ago by mf2k (Frank Schima)
Actually the java portgroup might be a more general solution.
comment:6 Changed 6 years ago by mattbishop (Matt Bishop)
I don't know how to use the java portgroup. I was able to use "depends_lib port:openjdk8" in my tomcat-native/Portfile but I am very open to better options.
comment:7 Changed 6 years ago by mf2k (Frank Schima)
Cc: | breun added |
---|
What if the user has the Oracle JDK installed? What if they have openjdk11 installed? Can either of these be used? I believe that the java portgroup allows that. I'm Cc'ing the author of the openjdk Portfile for possible comment.
comment:9 Changed 6 years ago by mf2k (Frank Schima)
Also look at the sleuthkit Portfile for an example of a port that uses the java portgroup.
comment:10 Changed 6 years ago by mf2k (Frank Schima)
The py-tensorflow Portfile is a better example because it shows how to set the minimum version of java required with a fallback openjdk requirement.
comment:11 Changed 6 years ago by mattbishop (Matt Bishop)
I tried the py-tensorflow approach and didn't find a lot of joy. It looks like it cannot pick up the JAVA_HOME that was set earlier in the port file:
# Required java version java.version 1.8 # JDK port to install if required java not found java.fallback openjdk8 if {[info exists env(JAVA_HOME)]} { configure.args-append --with-java-home="$env(JAVA_HOME)" } else { configure.args-append --with-java-home="${java.home}" }
... main.log:
:debug:configure JAVA_HOME='/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home' --with-java-home=""
Not sure why it can't pick up either java.home or JAVA_HOME.
This may not be a big deal as tomcat-native is a C lib using JNI headers in the JDK to build against. These headers are super-stable so any version will do. tomcat-native does not use the JRE/JDK at runtime but is loaded as a JNI lib by tomcat at launch. Usually the installer will have JDK installed in order to run tomcat. tomcat-native has no use outside of a tomcat runtime.
comment:12 Changed 6 years ago by breun (Nils Breunese)
I maintain the openjdk*
ports in MacPorts, but I'm not really familiar with the java portgroup, as I don't maintain any apps that use Java in MacPorts. The java portgroup was created by Chris Jones, maybe he can help? I know he also did the Tensorflow port. I'm not sure I can add him to the Cc: of this issue though.
comment:13 Changed 6 years ago by mf2k (Frank Schima)
Cc: | cjones051073 added |
---|
@breun: Thank you responding and for the suggestion. I have Cc'ed Chris.
@chris: Hoping to get your input. To be more clear, this is about updating tomcat-native. See also the related PR https://github.com/macports/macports-ports/pull/3680.
comment:14 Changed 6 years ago by mf2k (Frank Schima)
Component: | buildbot/mpbb → ports |
---|---|
Port: | tomcat-native added |
comment:15 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)
Summary: | JDK missing in Mojave images? → tomcat-native: JDK missing in Mojave images? |
---|
comment:16 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)
comment:17 Changed 6 years ago by cjones051073 (Chris Jones)
I did not originally create the java portgroup. See
https://github.com/macports/macports-ports/commits/master/_resources/port1.0/group/java-1.0.tcl
And select history to see the original authors.
I simply added a recent update to add the fallback option, which allows the user to define a macports provided openjdk port to be installed, if the requested java version is not found.
comment:18 Changed 6 years ago by cjones051073 (Chris Jones)
Also note, regarding JAVA_HOME it is not suprising what what was tried above fails to find it, as this is only set during specific phases. I.e. configure, build and destroot. See line 108 onwards in the portfroup file. If you wish to use this variable, you need to make sure you do so only during these phases.
comment:19 Changed 6 years ago by mattbishop (Matt Bishop)
I was able to adopt PortGroup java successfully in the above PR. Thanks for everyone's help! The port is simpler now with the portgroup usage.
comment:21 Changed 6 years ago by l2dy (Zero King)
Resolution: | → fixed |
---|---|
Status: | new → closed |
The Milestone field is for use by Macports team members only, please do not set it.
Note that a "request" ticket type is only for requesting a new port.