其实,这个对于不是很熟系sbt的人来说,或者对scala语言没有什么了解的人,接触Gatling这个开源的性能测试框架,还是有些茫然的。

因为GitHub上提供的Gatling (最新版本:2.2.0 snapshot)是源码,而且,完整的Gatling被拆分为Gatling(Core,相当于测试引擎吧)和Gatling-highchats(主要是用来生成测试报告)两部分。不知到为何要拆分为两部分,也许是因为Gatling-highchats部分引用了特殊license的软件插件(HighCharts & HighStock, 来自于HighSoft公司。。。)

1. 首先,从github上clone下gatling的源码。

git clone http://github.com/gatling/gatling

git clone http://github.com/gatling/gatling-highcharts

待这些文件都下载到本地后,先进入gatling的目录,在命令行下执行 sbt compile (,若你的系统下没有安装SBT,请先自己安装,我是直接在SBT官网下载的0.13.9的版本,解压到local目录下,再在/etc/profile下配置一下环境变量,方便使用)。gatling文件列表如下:

-rw-r--r--  root root  Jan   : CONTRIBUTING.md
drwxr-xr-x root root Jan : gatling-app
drwxr-xr-x root root Jan : gatling-bundle
drwxr-xr-x root root Jan : gatling-charts
drwxr-xr-x root root Jan : gatling-commons
drwxr-xr-x root root Jan : gatling-compiler
drwxr-xr-x root root Jan : gatling-core
drwxr-xr-x root root Jan : gatling-http
drwxr-xr-x root root Jan : gatling-jdbc
drwxr-xr-x root root Jan : gatling-jms
drwxr-xr-x root root Jan : gatling-metrics
drwxr-xr-x root root Jan : gatling-recorder
drwxr-xr-x root root Jan : gatling-redis
drwxr-xr-x root root Jan : gatling-test-framework
-rwxr-xr-x root root Jan : make_credentials.sh
-rw-r--r-- root root Jan : pgp.sbt
drwxr-xr-x root root Jan : project
-rw-r--r-- root root Jan : README.md
drwxr-xr-x root root Jan : src
drwxr-xr-x root root Jan : target
-rwxr-xr-x root root Jan : trigger_build.py
-rw-r--r-- root root Jan : version.sbt

sbt compile执行完毕后(可能需要一段时间,因为有些依赖的库要下载),需要将其发布到ivy仓库中(你也可以发布到mave仓库):

sbt publishLocal

 [root@CloudGame gatling]# sbt publishLocal
[info] Loading global plugins from /root/.sbt/0.13/plugins
[info] Loading project definition from /mnt/workwps/gatling2.1.7/gatling/project
[info] Set current project to gatling-parent (in build file:/mnt/workwps/gatling2.1.7/gatling/)
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-compiler/target/gatling-compiler-2.2.-SNAPSHOT-sources.jar ...
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-core/target/gatling-core-2.2.-SNAPSHOT-sources.jar ...
[info] Done packaging.
[info] Done packaging.
SLF4J: The following set of substitute loggers may have been accessed
SLF4J: during the initialization phase. Logging calls during this
SLF4J: phase were not honored. However, subsequent logging calls to these
SLF4J: loggers will work as normally expected.
SLF4J: See also http://www.slf4j.org/codes.html#substituteLogger
SLF4J: org.eclipse.aether.internal.impl.DefaultRepositorySystem
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-commons/target/gatling-commons-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-compiler/target/gatling-compiler-2.2.-SNAPSHOT.pom
[info] :: delivering :: io.gatling#gatling-commons;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-commons/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-compiler;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-compiler/target/ivy-2.2.-SNAPSHOT.xml
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-core/target/gatling-core-2.2.-SNAPSHOT.pom
[info] :: delivering :: io.gatling#gatling-core;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-core/target/ivy-2.2.-SNAPSHOT.xml
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-metrics/target/gatling-metrics-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-redis/target/gatling-redis-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-charts/target/gatling-charts-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-jms/target/gatling-jms-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-http/target/gatling-http-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-jdbc/target/gatling-jdbc-2.2.-SNAPSHOT.pom
[info] :: delivering :: io.gatling#gatling-metrics;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-metrics/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-jms;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-jms/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-charts;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-charts/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-redis;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-redis/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-jdbc;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-jdbc/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-http;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-http/target/ivy-2.2.-SNAPSHOT.xml
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-bundle/target/gatling-bundle-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/target/gatling-parent-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-app/target/gatling-app-2.2.-SNAPSHOT.pom
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-recorder/target/gatling-recorder-2.2.-SNAPSHOT.pom
[info] :: delivering :: io.gatling#gatling-bundle;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-bundle/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-app;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-app/target/ivy-2.2.-SNAPSHOT.xml
[info] :: delivering :: io.gatling#gatling-parent;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/target/ivy-2.2.-SNAPSHOT.xml
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-compiler/target/gatling-compiler-2.2.-SNAPSHOT.jar ...
[info] published gatling-bundle to /root/.ivy2/local/io.gatling/gatling-bundle/2.2.-SNAPSHOT/poms/gatling-bundle.pom
[info] Done packaging.
[info] published gatling-bundle to /root/.ivy2/local/io.gatling/gatling-bundle/2.2.-SNAPSHOT/zips/gatling-bundle-bundle.zip
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-bundle/2.2.-SNAPSHOT/ivys/ivy.xml
[info] :: delivering :: io.gatling#gatling-recorder;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-recorder/target/ivy-2.2.-SNAPSHOT.xml
[info] Wrote /mnt/workwps/gatling2.1.7/gatling/gatling-test-framework/target/gatling-test-framework-2.2.-SNAPSHOT.pom
[info] published gatling-parent to /root/.ivy2/local/io.gatling/gatling-parent/2.2.-SNAPSHOT/poms/gatling-parent.pom
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-parent/2.2.-SNAPSHOT/ivys/ivy.xml
[info] published gatling-commons to /root/.ivy2/local/io.gatling/gatling-commons/2.2.-SNAPSHOT/poms/gatling-commons.pom
[info] published gatling-commons to /root/.ivy2/local/io.gatling/gatling-commons/2.2.-SNAPSHOT/jars/gatling-commons.jar
[info] published gatling-commons to /root/.ivy2/local/io.gatling/gatling-commons/2.2.-SNAPSHOT/srcs/gatling-commons-sources.jar
[info] published gatling-commons to /root/.ivy2/local/io.gatling/gatling-commons/2.2.-SNAPSHOT/docs/gatling-commons-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-commons/2.2.-SNAPSHOT/ivys/ivy.xml
[info] published gatling-compiler to /root/.ivy2/local/io.gatling/gatling-compiler/2.2.-SNAPSHOT/poms/gatling-compiler.pom
[info] published gatling-compiler to /root/.ivy2/local/io.gatling/gatling-compiler/2.2.-SNAPSHOT/jars/gatling-compiler.jar
[info] published gatling-compiler to /root/.ivy2/local/io.gatling/gatling-compiler/2.2.-SNAPSHOT/srcs/gatling-compiler-sources.jar
[info] published gatling-compiler to /root/.ivy2/local/io.gatling/gatling-compiler/2.2.-SNAPSHOT/docs/gatling-compiler-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-compiler/2.2.-SNAPSHOT/ivys/ivy.xml
[info] :: delivering :: io.gatling#gatling-test-framework;2.2.-SNAPSHOT :: 2.2.-SNAPSHOT :: integration :: Fri Jan :: CST
[info] delivering ivy file to /mnt/workwps/gatling2.1.7/gatling/gatling-test-framework/target/ivy-2.2.-SNAPSHOT.xml
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-jms/target/api...
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-jdbc/target/api...
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-charts/target/api...
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-metrics/target/api...
model contains documentable templates
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-redis/target/api...
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-http/target/api...
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-jdbc/target/gatling-jdbc-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-core/target/gatling-core-2.2.-SNAPSHOT.jar ...
[info] Done packaging.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-metrics/target/gatling-metrics-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-redis/target/gatling-redis-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] published gatling-core to /root/.ivy2/local/io.gatling/gatling-core/2.2.-SNAPSHOT/poms/gatling-core.pom
[info] published gatling-core to /root/.ivy2/local/io.gatling/gatling-core/2.2.-SNAPSHOT/jars/gatling-core.jar
[info] published gatling-core to /root/.ivy2/local/io.gatling/gatling-core/2.2.-SNAPSHOT/srcs/gatling-core-sources.jar
[info] published gatling-core to /root/.ivy2/local/io.gatling/gatling-core/2.2.-SNAPSHOT/docs/gatling-core-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-core/2.2.-SNAPSHOT/ivys/ivy.xml
[info] published gatling-jdbc to /root/.ivy2/local/io.gatling/gatling-jdbc/2.2.-SNAPSHOT/poms/gatling-jdbc.pom
[info] published gatling-jdbc to /root/.ivy2/local/io.gatling/gatling-jdbc/2.2.-SNAPSHOT/jars/gatling-jdbc.jar
[info] published gatling-jdbc to /root/.ivy2/local/io.gatling/gatling-jdbc/2.2.-SNAPSHOT/srcs/gatling-jdbc-sources.jar
[info] published gatling-jdbc to /root/.ivy2/local/io.gatling/gatling-jdbc/2.2.-SNAPSHOT/docs/gatling-jdbc-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-jdbc/2.2.-SNAPSHOT/ivys/ivy.xml
[info] published gatling-redis to /root/.ivy2/local/io.gatling/gatling-redis/2.2.-SNAPSHOT/poms/gatling-redis.pom
[info] published gatling-redis to /root/.ivy2/local/io.gatling/gatling-redis/2.2.-SNAPSHOT/jars/gatling-redis.jar
[info] published gatling-redis to /root/.ivy2/local/io.gatling/gatling-redis/2.2.-SNAPSHOT/srcs/gatling-redis-sources.jar
[info] published gatling-redis to /root/.ivy2/local/io.gatling/gatling-redis/2.2.-SNAPSHOT/docs/gatling-redis-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-redis/2.2.-SNAPSHOT/ivys/ivy.xml
[info] published gatling-metrics to /root/.ivy2/local/io.gatling/gatling-metrics/2.2.-SNAPSHOT/poms/gatling-metrics.pom
[info] published gatling-metrics to /root/.ivy2/local/io.gatling/gatling-metrics/2.2.-SNAPSHOT/jars/gatling-metrics.jar
[info] published gatling-metrics to /root/.ivy2/local/io.gatling/gatling-metrics/2.2.-SNAPSHOT/srcs/gatling-metrics-sources.jar
[info] published gatling-metrics to /root/.ivy2/local/io.gatling/gatling-metrics/2.2.-SNAPSHOT/docs/gatling-metrics-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-metrics/2.2.-SNAPSHOT/ivys/ivy.xml
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-app/target/api...
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-recorder/target/api...
[info] Main Scala API documentation successful.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-jms/target/gatling-jms-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-app/target/gatling-app-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] published gatling-jms to /root/.ivy2/local/io.gatling/gatling-jms/2.2.-SNAPSHOT/poms/gatling-jms.pom
[info] published gatling-jms to /root/.ivy2/local/io.gatling/gatling-jms/2.2.-SNAPSHOT/jars/gatling-jms.jar
[info] published gatling-jms to /root/.ivy2/local/io.gatling/gatling-jms/2.2.-SNAPSHOT/srcs/gatling-jms-sources.jar
[info] published gatling-jms to /root/.ivy2/local/io.gatling/gatling-jms/2.2.-SNAPSHOT/docs/gatling-jms-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-jms/2.2.-SNAPSHOT/ivys/ivy.xml
[info] published gatling-app to /root/.ivy2/local/io.gatling/gatling-app/2.2.-SNAPSHOT/poms/gatling-app.pom
[info] published gatling-app to /root/.ivy2/local/io.gatling/gatling-app/2.2.-SNAPSHOT/jars/gatling-app.jar
[info] published gatling-app to /root/.ivy2/local/io.gatling/gatling-app/2.2.-SNAPSHOT/srcs/gatling-app-sources.jar
[info] published gatling-app to /root/.ivy2/local/io.gatling/gatling-app/2.2.-SNAPSHOT/docs/gatling-app-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-app/2.2.-SNAPSHOT/ivys/ivy.xml
[info] Main Scala API documentation to /mnt/workwps/gatling2.1.7/gatling/gatling-test-framework/target/api...
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-test-framework/target/gatling-test-framework-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] published gatling-test-framework to /root/.ivy2/local/io.gatling/gatling-test-framework/2.2.-SNAPSHOT/poms/gatling-test-framework.pom
[info] published gatling-test-framework to /root/.ivy2/local/io.gatling/gatling-test-framework/2.2.-SNAPSHOT/jars/gatling-test-framework.jar
[info] published gatling-test-framework to /root/.ivy2/local/io.gatling/gatling-test-framework/2.2.-SNAPSHOT/srcs/gatling-test-framework-sources.jar
[info] published gatling-test-framework to /root/.ivy2/local/io.gatling/gatling-test-framework/2.2.-SNAPSHOT/docs/gatling-test-framework-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-test-framework/2.2.-SNAPSHOT/ivys/ivy.xml
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-charts/target/gatling-charts-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] published gatling-charts to /root/.ivy2/local/io.gatling/gatling-charts/2.2.-SNAPSHOT/poms/gatling-charts.pom
[info] published gatling-charts to /root/.ivy2/local/io.gatling/gatling-charts/2.2.-SNAPSHOT/jars/gatling-charts.jar
[info] published gatling-charts to /root/.ivy2/local/io.gatling/gatling-charts/2.2.-SNAPSHOT/srcs/gatling-charts-sources.jar
[info] published gatling-charts to /root/.ivy2/local/io.gatling/gatling-charts/2.2.-SNAPSHOT/docs/gatling-charts-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-charts/2.2.-SNAPSHOT/ivys/ivy.xml
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-recorder/target/gatling-recorder-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] published gatling-recorder to /root/.ivy2/local/io.gatling/gatling-recorder/2.2.-SNAPSHOT/poms/gatling-recorder.pom
[info] published gatling-recorder to /root/.ivy2/local/io.gatling/gatling-recorder/2.2.-SNAPSHOT/jars/gatling-recorder.jar
[info] published gatling-recorder to /root/.ivy2/local/io.gatling/gatling-recorder/2.2.-SNAPSHOT/srcs/gatling-recorder-sources.jar
[info] published gatling-recorder to /root/.ivy2/local/io.gatling/gatling-recorder/2.2.-SNAPSHOT/docs/gatling-recorder-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-recorder/2.2.-SNAPSHOT/ivys/ivy.xml
model contains documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /mnt/workwps/gatling2.1.7/gatling/gatling-http/target/gatling-http-2.2.-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] published gatling-http to /root/.ivy2/local/io.gatling/gatling-http/2.2.-SNAPSHOT/poms/gatling-http.pom
[info] published gatling-http to /root/.ivy2/local/io.gatling/gatling-http/2.2.-SNAPSHOT/jars/gatling-http.jar
[info] published gatling-http to /root/.ivy2/local/io.gatling/gatling-http/2.2.-SNAPSHOT/srcs/gatling-http-sources.jar
[info] published gatling-http to /root/.ivy2/local/io.gatling/gatling-http/2.2.-SNAPSHOT/docs/gatling-http-javadoc.jar
[info] published ivy to /root/.ivy2/local/io.gatling/gatling-http/2.2.-SNAPSHOT/ivys/ivy.xml
[success] Total time: s, completed Jan , :: PM

这个过程,比较像mvn install将生成的模块安装到本地.m2仓库中的过程。到此,gatling引擎部分编译和发布完成。

然后,进入gatling-highchats,和上述编译gatling的过程类似,执行sbt compile,然后在发布到本地ivy仓库。注意,一定要先对gatling进行发布后再编译gatling-highchats,否则在编译gatling-highchats的时候会报错的,找不到依赖的库

至此,编译部分都完成了,那么,问题来了,生成的工具(可执行文件)在什么地方呢?在什么地方可以执行刚才生成的工具呢?官网上说的比较清楚,我也倾向于用bundle的文件来执行。默认情况下,这个文件会在ivy的仓库里面。就拿我的环境来说,其目录如下:

 [root@CloudGame zips]# pwd
/root/.ivy2/local/io.gatling.highcharts/gatling-charts-highcharts-bundle/2.2.-SNAPSHOT/zips

文件内容如下:

 [root@CloudGame gatling-charts-highcharts-bundle-2.2.-SNAPSHOT]# ll
total
drwxr-xr-x root root Jan : bin
drwxr-xr-x root root Jan : lib
-rw-r--r-- root root Jan : LICENSE
drwxr-xr-x root root Jan : results
drwxr-xr-x root root Jan : user-files
[root@CloudGame gatling-charts-highcharts-bundle-2.2.-SNAPSHOT]# cd bin/
[root@CloudGame bin]# ll
total
-rwxr--r-- root root Jan : gatling.bat
-rwxr--r-- root root Jan : gatling.sh
-rwxr--r-- root root Jan : recorder.bat
-rwxr--r-- root root Jan : recorder.sh

上面加黑的目录,就是我们想要的被解压后的目录,里面有我们期待的内容:

 [root@CloudGame gatling-bundle-2.2.-SNAPSHOT]# ll
total
drwxr-xr-x root root Jan : bin
-rw-r--r-- root root Jan : LICENSE
drwxr-xr-x root root Jan : results
drwxr-xr-x root root Jan : user-files
[root@CloudGame gatling-bundle-2.2.-SNAPSHOT]# cd bin/
[root@CloudGame bin]# ll
total
-rwxr-xr-x root root Jan : gatling.bat
-rwxr-xr-x root root Jan : gatling.sh
-rwxr-xr-x root root Jan : recorder.bat
-rwxr-xr-x root root Jan : recorder.sh

到这里,可以说从源码生成gatling的过程结束了!

在此,我要说明一点就是,2.2.0-SNAPSHOT的版本,比较新,里面有些api是JDK8的,所以,在编译运行的时候,保证你的环境是jdk8哟,否则会出现下面的错误:

 [root@CloudGame bin]# ./recorder.sh
GATLING_HOME is set to /root/.ivy2/local/io.gatling.highcharts/gatling-charts-highcharts-bundle/2.2.-SNAPSHOT/zips/gatling-charts-highcharts-bundle-2.2.-SNAPSHOT
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigRenderOptions : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:)
at java.net.URLClassLoader.access$(URLClassLoader.java:)
at java.net.URLClassLoader$.run(URLClassLoader.java:)
at java.net.URLClassLoader$.run(URLClassLoader.java:)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:)
at java.lang.ClassLoader.loadClass(ClassLoader.java:)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:)
at java.lang.ClassLoader.loadClass(ClassLoader.java:)
at io.gatling.recorder.config.RecorderConfiguration$.<init>(RecorderConfiguration.scala:)
at io.gatling.recorder.config.RecorderConfiguration$.<clinit>(RecorderConfiguration.scala)
at io.gatling.recorder.GatlingRecorder$.io$gatling$recorder$GatlingRecorder$$initRecorder(GatlingRecorder.scala:)
at io.gatling.recorder.GatlingRecorder$$anonfun$fromArgs$.apply(GatlingRecorder.scala:)
at io.gatling.recorder.GatlingRecorder$$anonfun$fromArgs$.apply(GatlingRecorder.scala:)
at scala.Option.map(Option.scala:)
at io.gatling.recorder.GatlingRecorder$.fromArgs(GatlingRecorder.scala:)
at io.gatling.recorder.GatlingRecorder$.main(GatlingRecorder.scala:)
at io.gatling.recorder.GatlingRecorder.main(GatlingRecorder.scala)

最后,测试一下源码来的工具是否可用,哈哈,看到recorder的启动界面了,如下图,说明一切正常!

附加一下设置项目的javaHome的命令,即相关的操作!

 gatling-parent > set every javaHome := sys.env.get("JAVA_HOME") map file
[info] Defining */*:javaHome
[info] The new value will be used by gatling-app/*:compilers, gatling-app/*:console::compilers and 125 others.
[info] Run `last` for details.
[info] Reapplying settings...
[info] Set current project to gatling-parent (in build file:/mnt/workwps/gatling2.1.7/gatling/)
gatling-parent > show javaHome
[info] gatling-core/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-compiler/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-redis/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-metrics/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-commons/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-recorder/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-jms/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-app/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-test-framework/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-http/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-charts/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-bundle/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-jdbc/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
[info] gatling-parent/*:javaHome
[info] Some(/usr/java/jdk1.8.0_65)
gatling-parent >

OK,完工!

如何通过源码生成Gatling可执行工具的更多相关文章

  1. 通过源码了解ASP.NET MVC 几种Filter的执行过程

    一.前言 之前也阅读过MVC的源码,并了解过各个模块的运行原理和执行过程,但都没有形成文章(所以也忘得特别快),总感觉分析源码是大神的工作,而且很多人觉得平时根本不需要知道这些,会用就行了.其实阅读源 ...

  2. 通过源码了解ASP.NET MVC 几种Filter的执行过程 在Winform中菜单动态添加“最近使用文件”

    通过源码了解ASP.NET MVC 几种Filter的执行过程   一.前言 之前也阅读过MVC的源码,并了解过各个模块的运行原理和执行过程,但都没有形成文章(所以也忘得特别快),总感觉分析源码是大神 ...

  3. Linux下通过源码编译安装程序

    本文简单的记录了下,在linux下如何通过源码安装程序,以及相关的知识.(大神勿喷^_^) 一.程序的组成部分 Linux下程序大都是由以下几部分组成: 二进制文件:也就是可以运行的程序文件 库文件: ...

  4. 通过源码安装PostgresSQL

    通过源码安装PostgresSQL 1.1 下载源码包环境: Centos6.8 64位 yum -y install bison flex readline-devel zlib-devel yum ...

  5. 在centos6.7通过源码安装python3.6.7报错“zipimport.ZipImportError: can't decompress data; zlib not available”

    在centos6.7通过源码安装python3.6.7报错: zipimport.ZipImportError: can't decompress data; zlib not available 从 ...

  6. Kafka详解六:Kafka如何通过源码实现监控

    问题导读: 1.kafka的消费者组的消费偏移存储,kafka支持两个版本?        2.ConsumerOffsetChecker类的作用是什么?        3.Kafka如何通过源码实现 ...

  7. 通过源码编译安装VIM

    开发中使用的是Ubuntu 12.04 LTS,通过sudo apt-get install vim安装的版本较低,不支持YCM,所以,用源码编译并安装最新的Vim. 卸载旧版本的Vim: sudo ...

  8. 通过源码分析Java开源任务调度框架Quartz的主要流程

    通过源码分析Java开源任务调度框架Quartz的主要流程 从使用效果.调用链路跟踪.E-R图.循环调度逻辑几个方面分析Quartz. github项目地址: https://github.com/t ...

  9. echarts 通过源码方法 传入对应data数据获取分割步长值

    通过源码方法获取这里的分割数字长度 /** * Quantity of a number. e.g. 0.1, 1, 10, 100 * * @param {number} val * @return ...

随机推荐

  1. magento -- 如何改善前台图片质量

    magento做的网店的前台产品图片仔细看会发现不够清晰,质量比原图损失较大,这是因为系统在用GD2压缩图片时默认压缩质量是80%.为了提高产品图片质量,我们可以修改代码来改变压缩质量的百分比,比如9 ...

  2. 深入理解JavaScript闭包

    Closure 闭包的定义1: <JavaScript高级程序设计>定义闭包:闭包是指有权访问另一个函数作用域中的变量的函数. 创建闭包的常见方式,就是在一个函数内部创建另一个函数. 然而 ...

  3. Flume NG之Interceptor简介

    转载地址:http://www.cnblogs.com/lxf20061900/p/3658172.html 有的时候希望通过Flume将读取的文件再细分存储,比如讲source的数据按照业务类型分开 ...

  4. MySQL数据库恢复的经历。

    蛋疼,定时任务设置错误.把数据给删除了.还有一次是服务器时间不对,也把数据给删除了. 还好,开启了二进制日志,才算把数据找回,但是速度效率也太低. 痛定思变.在把一切交由电脑工作的时候,也要做好一定的 ...

  5. poj3249 Test for Job ——拓扑+DP

    link:http://poj.org/problem?id=3249 在拓扑排序的过程中进行状态转移,dp[i]表示从起点到 i 这个点所得到的的最大值.比如从u点到v点,dp[v]=max(dp[ ...

  6. linux 网络协议分析---3

    本章节主要介绍linxu网络模型.以及常用的网络协议分析以太网协议.IP协议.TCP协议.UDP协议 一.网络模型 TCP/IP分层模型的四个协议层分别完成以下的功能: 第一层 网络接口层 网络接口层 ...

  7. ipconfig /flushdns 解释

    当我们一域名的形式访问过目标网站后,该网站的域名和IP地址对应关系就会自动保存到本地工作站的DNS缓存列表中,如果以后再次访问该域名,浏览器就会先访问DNS缓存列表中的信息.但是,如果被访问网站的域名 ...

  8. PHP 安装 eaccelerator

    安装开发工具包: yum groupinstall -y "Development Tools" 查看本机php版本: rpm -qi php 下载rpm包: wget http: ...

  9. meta name="viewport" 属性详解

    随着高端手机(Andriod,Iphone,Ipod,WinPhone等)的盛行,移动互联应用开发也越来越受到人们的重视,用html5开发移动应用是最好的选择.然而,每一款手机有不同的分辨率,不同屏幕 ...

  10. (转) SLAM系统的研究点介绍 与 Kinect视觉SLAM技术介绍

          首页 视界智尚 算法技术 每日技术 来打我呀 注册     SLAM系统的研究点介绍 本文主要谈谈SLAM中的各个研究点,为研究生们(应该是博客的多数读者吧)作一个提纲挈领的摘要.然后,我 ...