Git Product home page Git Product logo

Comments (6)

christopher-johnson avatar christopher-johnson commented on August 25, 2024 1

I agree. It could be documented with a reference to the dependencies here. I do that and submit a PR shortly.

from trellis.

acoburn avatar acoburn commented on August 25, 2024

@christopher-johnson would make sense to add a profile that selectively adds this dependency? I would want to make sure that h2 is still well supported on JDK 1.8

from trellis.

christopher-johnson avatar christopher-johnson commented on August 25, 2024

I think that supporting ALPN on JDK 1.8 is not so straightforward as JDK 9+, unless a specific version (e.g. 1.8.0u152).

"The ALPN implementation, relying on modifications of OpenJDK classes, updates every time there are updates to the modified OpenJDK classes." [1]

Binding a alpnBootVersion to a specific version of the JDK 8 is possible, I guess. The alpn-server only works on JDK 9, so JDK 8 seems to require alpn-boot (have not tested this yet).

Something like this could work:

     if (Jvm.current().getJavaVersion().isJava9Compatible() || Jvm.current().getJavaVersion().isJava10Compatible()) {
        compile group: 'org.eclipse.jetty', name: 'jetty-alpn-java-server', version: jettyAlpnServerVersion
    } else {
        compile group: 'org.mortbay.jetty.alpn', name: 'alpn-boot', version: jettyAlpnBootVersion
    }

[1] https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-versions

from trellis.

christopher-johnson avatar christopher-johnson commented on August 25, 2024

In order to make ALPN work on JDK 8, one needs to add -Xbootclasspath/p:$path_to_alpn_boot.jar as a JVM option. This is probably not feasible to do with gradle as it involves copying the alpn_boot library (from some flat_dir in the repo) to the build host, and then adding a applicationDefaultJvmArgs to modify the application start script. It is pretty easy to set JAVA_OPTS in docker, and then copy the lib into the image at that path, with something like this:

ENV ALPN_BOOT alpn-boot-8.1.12.v20180117.jar
ENV TRELLIS_RUNTIME /opt
ENV JAVA_OPTS="-Xms250m -Xmx1024m -Xbootclasspath/p:${TRELLIS_RUNTIME}/${ALPN_BOOT}"

I tested this and it works.

The question of how or if to conditionally support 9 ,10 and eventually 11 builds in the trellis gradle scripts is open. To build trellis-app with H2 for 9 only requires a couple of changes (adding the compile dependency on alpn-java-server and changing the target to 1.9). The alpn-java-server is a transitive dependency that is already included with dropwizard http2, and I guess the gradle declaration includes it to the runtime classpath(?).

To build for 10 requires excluding jacoco (you know about this), and to avoid javadoc warnings, adding this:

task docs(type: Javadoc) {
        doFirst {
            if (Jvm.current().getJavaVersion().isJava10Compatible()) {
                addBooleanOption('html5', true)
            }
        }
    ...

One other note is that the trellis-app build.gradle includes this:

artifacts {
    archives javadocJar
    archives sourceJar
}

I think that this can be removed since it is already in the rootProject build.gradle.

from trellis.

acoburn avatar acoburn commented on August 25, 2024

@christopher-johnson feel free to issue a PR that removes the redundant artifacts section.

For the ALPN support in JDK 1.8, it seems like a docker-based solution would be best.

As for supporting jdk9+ builds, this will probably be an ongoing discussion. I'd like to have really solid support for JDK 1.8 but at the same time make it possible to build for newer environments. If that involves profiles or gradle conditional logic, let's continue to explore that.

from trellis.

acoburn avatar acoburn commented on August 25, 2024

This issue seems to be very much dependent on the deployment environment with little, if anything, to do with the Trellis codebase. I would like to either suggest that this issue be closed as-is (with no changes) or else be closed after some relevant documentation is added to one of the README files.

from trellis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.