Gewusst wie: übergeben Sie Parameter an die main-Methode mit Gradle?

Habe ich übergeben zwei Argumente zu meiner main-Methode. Mein build-Skript ist

//Apply the java plugin to add support for Java
apply plugin: 'java'

//In this section you declare where to find the dependencies of your project
repositories {
    //Use 'maven central' for resolving your dependencies.
    mavenCentral()
}

//In this section you declare the dependencies for your production and test code
dependencies {
    compile 'com.example:example-core:1.7.6'
}

task main(type: JavaExec, dependsOn: classes) {
    description = 'This task will start the main class of the example project'
    group = 'Example'
    main = 'com.example.core.Example'
    classpath = sourceSets.main.runtimeClasspath

}

Wenn ich versuchen:

gradlew main doc.json text.txt

Dann ist ein Fehler aufgetreten.

org.gradle.execution.TaskSelectionException: Task 'doc.json' not found in root project

Wie kann ich Argumente zu meiner main-Methode Befehlszeile einfach?

InformationsquelleAutor Xelian | 2014-03-15
Schreibe einen Kommentar