DEV Community

Query Filter
Query Filter

Posted on

bridge20

// --- CONSOLIDATED HEADER ---
def jh = System.getenv('JAVA_HOME') ?: System.getProperty('java.home')
if (!jh) {
    throw new GradleException("JAVA_HOME environment variable not set.")
}

// 1. Define toolsJarFile once for use in your instanceClasspath later
def toolsJarFile = []
if (JavaVersion.current().isJava8()) {
    def sj = file("${jh}/lib/tools.jar")
    if (!sj.exists()) sj = file("${jh}/../lib/tools.jar")
    if (sj.exists()) toolsJarFile = sj
}

// 2. Prepare the Application plugin (Shadow 7.1.2 requires this for its internal checks)
if (!project.plugins.hasPlugin('application')) {
    apply plugin: 'application'
}

application {
    mainClass.set("comet.agent.UniversalAttacher")
}

// 3. Disable standard app tasks to avoid COMET/CPLS packaging conflicts
tasks.distZip.enabled = false
tasks.distTar.enabled = false
tasks.startScripts.enabled = false

// 4. Set legacy property for older task lookups
project.ext.mainClassName = "comet.agent.UniversalAttacher"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)