DEV Community

Query Filter
Query Filter

Posted on

store3

task runQuantum(type: JavaExec) {
    dependsOn prepareLibDir, classes

    systemProperty "org.gradle.scan.acceptTerm", "true"

    doFirst {
        setTmpDir()
        buildFileSystem("$curInst.temp")
        jvmArgs += prepareJvmArgs()

        // Define paths
        def tempDir = "${System.properties['java.io.tmpdir']}/$curInst.temp"
        def ddsFolder = file("$tempDir/dds")
        def quantumJarFile = sourceSets.main.runtimeClasspath.filter {
            it.name.endsWith('.jar') && it.name.contains("quantum")
        }

        // Build classpath with the dds folder explicitly included
        classpath = files(
            instanceClasspath,
            quantumJarFile,
            sourceSets.main.runtimeClasspath,
            ddsFolder  // Add the dds folder directly
        )

        // Also add the dds folder as a system property if needed
        systemProperty "dds.rules.dir", ddsFolder.absolutePath

        // If the dds folder contains compiled classes, ensure they're on classpath
        if (ddsFolder.exists()) {
            println "DDS folder found at: ${ddsFolder.absolutePath}"
            println "Contents: ${ddsFolder.list()?.join(', ')}"

            // If there are JARs in dds folder, add them individually
            ddsFolder.eachFile { file ->
                if (file.name.endsWith('.jar')) {
                    classpath += files(file)
                    println "Added JAR to classpath: ${file.name}"
                }
            }
        }

        // Debug: Print full classpath
        println "Full classpath:"
        classpath.each { println "  $it" }

        main = 'com.citigroup.get.quantum.server.Server'
        args "file://${file("src/main/config/quantum/$curInst.asset/$curInst.region/${curInst.country ?: "/$curInst.env"}")}",
             "$curInst.instance",
             'dummy'

        workingDir file('src/main/config')
        standardInput = System.in
    }

    logger.info "Task: $task_name completes execution"
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)