Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
sourceSets {
    main {
         java {
            srcDirs = ['src']
         }
    }

    test {
        java {
            srcDirs = ['test']
        }
    }
}


Samples

Code Block
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.11
targetCompatibility = 1.11

repositories {
    jcenter()
}

dependencies {
    testCompile project(":cipher")
    testCompile project(":is")
    testCompile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
    testCompile 'com.google.protobuf:protobuf-java:3.6.1'
    testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile('org.testcontainers:testcontainers:1.10.5')
    testCompile('org.assertj:assertj-core:3.8.0')
    testCompile('io.rest-assured:rest-assured:3.0.3')
    testCompile('io.rest-assured:json-schema-validator:3.0.3')
    testCompile('io.rest-assured:json-path:3.0.3')
    testCompile('ch.qos.logback:logback-classic:1.2.3')
    testCompile('io.cucumber:cucumber-java8:4.7.1')
    testCompile('io.cucumber:cucumber-junit:4.7.1')
    testCompile('io.cucumber:cucumber-picocontainer:3.0.2')
    testCompile('org.bouncycastle:bcprov-jdk15on:1.60')
    testCompile('com.auth0:java-jwt:3.4.0')
    testCompile('org.apache.commons:commons-lang3:3.7')
    testCompile('org.mock-server:mockserver-client-java:5.5.1')
    testCompile group: 'com.rabbitmq', name: 'amqp-client', version: '5.5.2'
    testCompile group: 'org.json', name: 'json', version: '20180813'
    testCompile group: 'commons-cli', name: 'commons-cli', version: '1.4'
}

task testJar(type: Jar) {
    from { configurations.testCompile.collect { it.isDirectory() ? it : zipTree(it) } }
    from sourceSets.test.output.classesDirs
    from sourceSets.test.resources
    jar

    exclude "META-INF/*.SF"
    exclude "META-INF/*.DSA"
    exclude "META-INF/*.RSA"

}

task copyBVTDockerfile(type: Copy) {
    from 'src/main/docker'
    into 'build/libs'
}


task buildBVTDockerImage(type: Exec) {
    workingDir "build/libs"
    commandLine "docker", "build", "--build-arg", "VERSION=${project.version}", "--tag", "${rootProject.name}/${project.name}:${project.version}", "./"
}

testJar.dependsOn(testClasses)

buildBVTDockerImage.dependsOn(copyBVTDockerfile,testJar)
build.dependsOn(buildBVTDockerImage)


References

...