Code Monkey home page Code Monkey logo

Comments (2)

skybber avatar skybber commented on August 9, 2024

jbr 17 automatically adds these JVM arguments (you must add them to jdk17 JVM opts):

--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.desktop/com.sun.beans=ALL-UNNAMED --add-opens --add-opens
 java.desktop/com.sun.beans.introspect=ALL-UNNAMED --add-opens java.desktop/com.sun.beans.util=ALL-UNNAMED

from hotswapagent.

reubenfirmin avatar reubenfirmin commented on August 9, 2024

Great, solved. Thank you!

FYI my final config here:

application {
    mainClass.set("my.main.class")

    tasks.named<JavaExec>("run") {

        // a little brittle but it works
        val hotswapAgentCore = configurations.first { it.name == "allSourceSetsCompileDependenciesMetadata" }.let {
            it.fileCollection(it.allDependencies.first { it.name.startsWith("hotswap") })
                .files
                .first()
        }

        if (hotswapAgentCore != null) {
            println("Monitoring ${project.buildDir.absolutePath}/classes/kotlin/jvm/main/ for changes!")
            jvmArgs(
                "-javaagent:${hotswapAgentCore.absolutePath}=autoHotswap=true",
                "--add-opens", "java.base/java.lang=ALL-UNNAMED",
                "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
                "--add-opens", "java.base/java.io=ALL-UNNAMED",
                "--add-opens", "java.desktop/java.beans=ALL-UNNAMED",
                "--add-opens", "java.desktop/com.sun.beans=ALL-UNNAMED",
                "--add-opens", "java.desktop/com.sun.beans.introspect=ALL-UNNAMED",
                "--add-opens", "java.desktop/com.sun.beans.util=ALL-UNNAMED",
                "-Dhotswap.classes.dir=${project.buildDir.absolutePath}/classes/kotlin/jvm/main/"

            )
        } else {
            throw IllegalStateException("Hotswap Agent Core dependency not found in the 'implementation' configuration.")
        }

        val main by sourceSets.getting
        args = main.output.asPath.split(":")
    }
}

from hotswapagent.

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.