其实,这个对于不是很熟系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. UI学习笔记---第二天

    程序的执行流程 一.自定义视图 自定义UILebal-UITextField视图 ⾃定义视图:系统标准UI之外,⾃己组合而出的新的视图. 实际开发中,我们还需⾃定义视图.积累⾃己的代码库.⽅便开发. ...

  2. windows 任务栏图标宽度固定

    这个需要修改注册表. win+r regedit ->enter 找到以下项 HKEY_CURRENT_USER-Control Panel-Desktop-WindowsMetrics 新建字 ...

  3. C#使用FtpWebRequest上传文件

    System.Net命名空间下的FtpWebRequest类实现了ftp协议的.Net实现. FtpWebRequest.KeepAlive指定在请求完成后服务器是否要马上关闭连接 FtpWebReq ...

  4. JS初学之-for套for遍历二维数组

    <!doctype html><html><head><meta charset="utf-8"><title>无标题文 ...

  5. html5的特性

    1.简化的语法更简单的doctype声明是HTML5里众多新特征之一.现在你只需要写,这就行了.HTML5的语法兼容HTML4和XHTML1,但不兼容SGML. 2. 一个替代Flash的新”canv ...

  6. c#---部分;把数组或者结构体存入集合里,然后再从集合中取出之后,输出;foreach既可以用到提取数组重点额数据,也可以提取集合中的数据(前提是集合中的元素是相同数据类型)

    1.输入班级人数,统计每个人的姓名,性别,年龄:集合与数组 //Console.Write("请输入班级人数:"); //int a = int.Parse(Console.Rea ...

  7. leetcode 120 Triangle ----- java

    Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...

  8. HDU-2196 Computer (树形DP)

    题目大意:在一棵带边权的有根树中,对于每个点,找出它与离它最远的那个点的之间的距离. 题目分析:对于一个点,离它最远的点只有两种情况,一是它到叶子节点的最远距离,一是与它父亲的距离加上他的父亲到叶子节 ...

  9. STL 简介,标准模板库

    这篇文章是关于C++语言的一个新的扩展--标准模板库的(Standard Template Library),也叫STL.  当我第一次打算写一篇关于STL的文章的时候,我不得不承认我当时低估了这个话 ...

  10. Optimize Managed Code For Multi-Core Machines

    Parallel Performance Optimize Managed Code For Multi-Core Machines Daan Leijen and Judd Hall This ar ...