Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add java-11-openjdk-jmods (#181) #198

Merged
merged 1 commit into from
Dec 7, 2018

Conversation

vorburger
Copy link
Collaborator

No description provided.

@vorburger
Copy link
Collaborator Author

@gunnarmorling do you think this should be part of the base image?

@vorburger
Copy link
Collaborator Author

oh hang on while this works for Java 11 it produces this for the Java 8 image:

No package java-1.8.0-openjdk-jmods-1.8.0.181-3.b13.el7_5 available.

Unfortunately that message is tucked away in the build and hard to see - it ideally really should fail for unknown packages IMHO.

@vorburger
Copy link
Collaborator Author

ideally really should fail for unknown packages IMHO

yum --setopt=skip_missing_names_on_install=False

@vorburger
Copy link
Collaborator Author

I guess this can be ignored:

Main config did not have a skip_missing_names_on_install attr. before setopt

@vorburger
Copy link
Collaborator Author

@gunnarmorling I like to do TDD even for something like this - can you propose a test command to run to verify if whatever java-11-openjdk-jmods adds actually works in the container (and which fails if it's not installed) ?

@gunnarmorling
Copy link

@vorburger Yes, I think the jmods package should be part of the image for JDK 11 (but not 8, where it doesn't exist, as you found out).

In order to test it, you could run the jlink tool. This creates a small variant of the JDK only containing selected modules (well, it will be really small if that bug has been resolved ;)). The jmods package contains the module files of the JDK which will be used by jlink for creating such "modular runtime images".

The following shows an example. It produces a runtime image with simple main class and a launcher script:

mkdir -p src/main/java/com/example
mkdir modules

cat > src/main/java/com/example/Main.java << EOF
package com.example;

public class Main {

    public static void main(String... args) {
        System.out.println("Hello, jlink!");
    }
}
EOF

cat > src/main/java/module-info.java << EOF
module com.example {
}
EOF

javac -g -d modules/com.example $(find src/main/java -name "*.java")

jlink --module-path modules --add-modules com.example --output img --launcher run=com.example/com.example.Main

Running this image via the created launcher script will print "Hello, jlink", if everything works as it should (note the image is fully self-contained at this point, i.e. it also could run on another system without a Java installation):

./img/bin/run

but do not install it on Java 8
@vorburger vorburger force-pushed the java-11-openjdk-jmods branch from 3e95a00 to a08555a Compare December 7, 2018 00:14
@vorburger vorburger merged commit b9a5430 into fabric8io-images:master Dec 7, 2018
@vorburger
Copy link
Collaborator Author

@gunnarmorling I've just merged this, so you now have java-11-openjdk-jmods.

Thanks a lot for the full example - to be picked up in # 181!

@vorburger
Copy link
Collaborator Author

Reverted this again, for now; see #181.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants