Opened 5 years ago

Closed 5 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 5 years ago by mf2k (Frank Schima)

Milestone: MacPorts Future
Type: requestenhancement

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.

comment:2 Changed 5 years ago by mf2k (Frank Schima)

Version: 2.5.4

comment:3 Changed 5 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 5 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 5 years ago by mf2k (Frank Schima)

Actually the java portgroup might be a more general solution.

comment:6 Changed 5 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 5 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:8 Changed 5 years ago by mf2k (Frank Schima)

@breun: Can you comment please?

comment:9 Changed 5 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 5 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 5 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.

Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:12 Changed 5 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 5 years ago by mf2k (Frank Schima)

Cc: cjones051073 added

@breun: Thank you responding and for the suggestion. I have Cc'ed Chris.

@cjones051073: 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.

Last edited 5 years ago by mf2k (Frank Schima) (previous) (diff)

comment:14 Changed 5 years ago by mf2k (Frank Schima)

Component: buildbot/mpbbports
Port: tomcat-native added

comment:15 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: JDK missing in Mojave images?tomcat-native: JDK missing in Mojave images?

comment:16 in reply to:  3 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to mf2k:

I'm not sure that installing java on the buildbots is the solution here.

Java is installed on the buildbot workers. See #56000.

comment:17 Changed 5 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 thw user to define a macports provided openjdk port to be installed, if the requested java version is not found.

Version 0, edited 5 years ago by cjones051073 (Chris Jones) (next)

comment:18 Changed 5 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 5 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:20 Changed 5 years ago by mattbishop (Matt Bishop)

This issue can be closed.

comment:21 Changed 5 years ago by l2dy (Zero King)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.