apache/openwhisk

Docs: Add example on how to add dependencies for Java

Open

#2.942 geöffnet am 7. Nov. 2017

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Scala (1.177 Forks)batch import
documentationgood first issuehelp wanted

Repository-Metriken

Stars
 (6.777 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 17h 31m) (3 gemergte PRs in 30 T)

Beschreibung

It would be good is the Java section at least shows one way to build the jar using external dependencies.

Since we all in OpenWhisk are fans of gradle 🙄 maybe we can do one using gradle.

Here is a good example from @rabbah https://github.com/rabbah/wsk-qr/blob/master/build.gradle


apply plugin: 'java'

version = '1.0'

repositories {
    mavenCentral()
}

configurations {
    provided
    compile.extendsFrom provided
}

dependencies {
    provided 'com.google.code.gson:gson:2.6.2'
    compile 'com.google.zxing:core:3.3.0'
    compile 'com.google.zxing:javase:3.3.0'
}

jar {
    dependsOn configurations.runtime

    from {
        (configurations.runtime - configurations.provided).collect {
            it.isDirectory() ? it : zipTree(it)
        }
    }
}

then build jar for Action

gradle jar

Contributor Guide