DEV Community

Query Filter
Query Filter

Posted on

gradle6

task runQuantum(type: JavaExec, dependsOn: compileJava) {
    group = 'instances'
    description = 'Run Quantum Server with forced hostname using temporary hosts file'

    mainClass = 'bootstrap.BootstrapServer'
    classpath = sourceSets.main.runtimeClasspath + files('libs/external-jars')

    // 1. Create temp hosts file inside buildDir
    doFirst {
        def tempHosts = file("${buildDir}/tmp/hosts_override")
        tempHosts.parentFile.mkdirs()
        tempHosts.text = """
127.0.0.1 egtpsga56.nam.nsroot.net
"""
        project.ext.tempHostsFile = tempHosts
        println "Temporary hosts file created at: ${tempHosts}"
    }

    // 2. JVM args
    jvmArgs(
        "-Djdk.net.hosts.file=${project.ext.tempHostsFile.absolutePath}",
        "-Dforced.hostname=egtpsga56.nam.nsroot.net",
        "-Ddds.tmpdir=${buildDir}/dds_tmp"
    )

    // 3. Program args
    args "file://src/main/config/quantum/$asset/$region/$env", instanceName, "dummy"

    doFirst {
        println "JVM args: ${jvmArgs}"
        println "Working dir: ${workingDir}"
    }

    standardInput = System.in
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)