Gatling Gradle Build将scala模拟和配置文件添加为Fatjar

时间:2016-03-04 08:54:31

标签: scala gradle simulation gatling

我编写了build.gradle,它正在编译并生成fatjar。其中包括Fatjar中的加特林模拟文件。但是不能执行fatjar。其中说“找不到主要课程”。

以下是build.gradle

buildscript {
    repositories {
        jcenter()
        maven { url "https://oss.sonatype.org/content/groups/public" }
    }
    dependencies {
        classpath "com.github.mperry:gradle-gatling-plugin:0.2-SNAPSHOT"
    }
}

//mainClassName = "simulations.basic.KafkaSimulation2"

apply plugin: 'scala'
apply plugin: "com.github.mperry.gatling"

defaultTasks "build"

ext {
}

repositories {
    jcenter()
    maven { url "https://oss.sonatype.org/content/groups/public" }
}

/*
gatling {
    list true
    dryRun false
    include "simulations.basic.KafkaSimulation2" // include all simulations in this package
   // exclude ".*"
}

test.dependsOn gatlingRun
*/



dependencies {
    compile 'org.apache.commons:commons-io:1.3.2'
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
    compile 'org.scala-lang:scala-library:2.11.7'
    compile 'org.apache.kafka:kafka-clients:0.8.2.0'
    testCompile 'io.gatling.highcharts:gatling-charts-highcharts:2.1.+'
    compile "com.github.mperry:gradle-gatling-plugin:0.2-SNAPSHOT"
    compile files('src/main/resources/lib/gatling-kafka-assembly-0.1.0-SNAPSHOT.jar')
   // testCompile 'simulations.basic.KafkaSimulation2'

    runtime fileTree(dir: 'src', include: '*.scala')
//    runtime fileTree(dir: 'conf', include: '*.conf')

}

jar {
    manifest {

        attributes(

                'Main-Class': 'KafkaSimulation2',


        )
    }
}
sourceSets {
    api
    impl
    main {
        scala {
            srcDirs = ['src/test/scala', 'src/test/scala']
        }

    }
}
sourceSets {

        api
        impl
    }
jar {
        from sourceSets.api.output
        from sourceSets.impl.output
     }


task fatJar(type: Jar) {
    manifest.from jar.manifest
    classifier = 'confubers'
    destinationDir new File("$buildDir")
    into('lib'){
        from "$projectDir/conf"
    }
    from {
        configurations.compile.collect {
            it.isDirectory() ? it : zipTree(it)
        }
        configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
    } {
        exclude "META-INF/*.SF"
        exclude "META-INF/*.DSA"
        exclude "META-INF/*.RSA"
    }
    with jar
}

artifacts {
    archives fatJar

}

1 个答案:

答案 0 :(得分:0)

看起来你要做的就是在$app['config']['mail.*'];属性中提供一个完全限定的类名,而不只是名称:$from = $app['config']['email'];而不仅仅是{{ 1}}。