lingocoder
lingocoder


jarexec JarExec
A Gradle plugin that executes Java Jar files.

  Usage:  

    /* (1) Apply the jarexec plugin using the plugins DSL. */
    plugins{
        id 'com.lingocoder.jarexec' version '0.1'
    }
		
    /* (2) Configure repositories. jcenter is preferred by Gradle.org. */
    repositories {jcenter()}

    dependencies {
        /* Declare your api|implementation|testImplementation dependencies like you normally would. */
        api 'com.example:foo:0.0.0'

        /* (3) Declare a dependency on the executable jar that jarexec's :execjar task will execute. */
        runtimeOnly 'org.raml.jaxrs:raml-to-jaxrs-cli:3.0.5:jar-with-dependencies'
    }

    jarexec{
        /* (4) This example's input file. */
        def raml = file("src/main/resources/api.raml")
 
        /* (5) This example's output directory. */
        def jaxrs = file("$buildDir/generated/jaxrs")

        /* (6) Fetch your executable from the dependency cache */
        def jaxrsCli = jarhelper.fetch("org.raml.jaxrs:raml-to-jaxrs-cli:3.0.5:jar-with-dependencies").orElse(raml)

        /* (7) Optionally, confirm that your fetched jar is executable. */
        assert jarhelper.checkExecutable(jaxrsCli);

        /* (8) Configure jarexec's 'args' property with your list of arguments. */
        args = ["-r", "lingocoder", "-d", jaxrs.absolutePath, raml.absolutePath]

        /* (9) Configure jarexec's 'jar' property with your executable jar. */
        jar = jaxrsCli

        /* (10) Configure jarexec's 'watchInFile' property with your input file. */
        watchInFile = raml

        /* (11) Configure jarexec's 'watchOutDir' property with your output directory. */
        watchOutDir = jaxrs
    }
  From the command line, run:  

    $ gradle --build-cache execjar