java - 如何修复:java.lang.ClassNotFoundException:gradle gatlingRun 任务的 BasicSimulation?
问题描述
我正在尝试通过 gradle 运行一个加特林任务。我专门设置了我的 scala 源代码集,在运行 gatlingRun 之前运行 compileScala,但我不断收到错误消息:
java.lang.ClassNotFoundException: BasicSimulation
如何正确设置任务?build.gradle
: _
plugins {
id "com.github.lkishalmi.gatling" version "3.0.2"
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'scala'
sourceSets {
main {
scala {
srcDirs = ['src/gatling/simulations/']
}
}
}
dependencies {
compile "io.gatling:gatling-core:3.0.2"
compile "io.gatling:gatling-http:3.0.2"
compile 'io.gatling.highcharts:gatling-charts-highcharts:3.0.2'
compile 'org.scala-lang:scala-library:2.11.8'
}
gatling {
simulations = {
include "*.scala"
}
}
梯度语法:
gradlew compileScala gatlingRun -Dorg.gradle.java.home=C:\Users\saber.alex\Documents\jre1.8.0_91
错误:
> Task :gatlingRun
16:22:52.131 [main] INFO io.gatling.core.config.GatlingConfiguration$ - Gatling will try to use 'gatling.conf' as custom config file.
16:22:52.910 [GatlingSystem-akka.actor.default-dispatcher-2] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
16:22:54.045 [main] ERROR io.gatling.app.Gatling$ - Run crashed
java.lang.IllegalArgumentException: User defined Simulation class BasicSimulation could not be loaded
at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:79)
at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$4(Selection.scala:84)
at scala.Option.orElse(Option.scala:289)
at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$3(Selection.scala:84)
at scala.Option.flatMap(Option.scala:171)
at io.gatling.app.Selection$Selector.singleSimulationFromConfig(Selection.scala:82)
at io.gatling.app.Selection$Selector.$anonfun$selection$1(Selection.scala:52)
at scala.Option.getOrElse(Option.scala:121)
at io.gatling.app.Selection$Selector.selection(Selection.scala:44)
at io.gatling.app.Selection$.apply(Selection.scala:36)
at io.gatling.app.Runner.run0(Runner.scala:74)
at io.gatling.app.Runner.run(Runner.scala:61)
at io.gatling.app.Gatling$.start(Gatling.scala:74)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:47)
at io.gatling.app.Gatling$.main(Gatling.scala:39)
at io.gatling.app.Gatling.main(Gatling.scala)
Caused by: java.lang.ClassNotFoundException: BasicSimulation
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at io.gatling.app.Selection$Selector.$anonfun$singleSimulationFromConfig$2(Selection.scala:70)
at scala.util.Try$.apply(Try.scala:209)
at io.gatling.app.Selection$Selector.findUserDefinedSimulationInClassloader$1(Selection.scala:70)
... 15 common frames omitted
> Task :gatlingRun FAILED
3 actionable tasks: 3 executed
解决方案
一行回复You are missing the package here
推荐阅读
- javascript - 在外部 JavaScript 文件中查找用户控件的客户端 ID
- ios - 保持内存中的核心数据对象不被不相关的代码删除?
- typescript - TypeScript如何区分引用相同类型的类型别名
- ansible - 带有 uri 模块的 Ansible“local_action”发布带有变量的 json 正文
- python - 如何在 gmail 中验证凭据?
- gdb - 从自定义工具生成 valgrind gdb 中断
- c++ - 从 2 位输入输出 4 位年份
- java - 点燃集群不同的启动时间
- javascript - 不能在类的构造函数之外定义变量
- java - 无法在运行时设置 SolrDocument 注释