Gradle won't pass args to Java main

122 views Asked by At

I run this command:

./gradlew BL_generate -Pserverversion=10.3

for this Gradle task:

task BL_generate(type: JavaExec) {
    if (project.hasProperty('serverversion')) {
    args(serverversion)
    }
    dependsOn resources_cleaner_bl
    //dependsOn BL_generate_warmup
    jvmArgs = ["-Xms1024m","-Xmx1024m"]
    classpath sourceSets.main.runtimeClasspath
    systemProperties['isDummyRun'] = 'false'
    main = "com.waze.routing.automation.runners.BaselineGeneratorRunner"
}

and my Java main is:

public static void main(String args[]) {
        BaselineGeneratorRunner baselineGeneratorRunner = new BaselineGeneratorRunner();
        generateResponses(baselineGeneratorRunner);
        baselineGeneratorRunner.aggregate();

        if (args.length > 0) {
             globalSettings.blServerVersion = args[0];
             System.out.println("args: "+args[0]);
        }
    }

How come I don't see this print in the console?

0

There are 0 answers