对于Jmeter-Gradle集成,我创建了以下build.gradle文件并将其存储在我的本地目录中。
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'jmeter'
group = 'com.github.kulya'
archivesBaseName = 'jmeter-gradle-plugin'
ext.jmeterVersion = "2.13"
version = "1.3.3-$jmeterVersion-SNAPSHOT"
sourceCompatibility=JavaVersion.VERSION_1_6
targetCompatibility=JavaVersion.VERSION_1_6
def bootClasspathStr = "${System.env.'JAVA_HOME'}/jre/lib/rt.jar"
project.tasks.withType(AbstractCompile, { AbstractCompile ac ->
ac.options.bootClasspath = bootClasspathStr // options is always there but not defined on AbstractCompile so going to hit it anyway
})
repositories {
maven {
url "http://nexus2.sdmc.ao-srv.com/content/groups/inhouse_dit/"
}
}
buildscript {
repositories {
maven {
url "http://nexus2.sdmc.ao-srv.com/content/groups/inhouse_dit/"
}
}
dependencies {
//classpath "com.github.kulya:jmeter-gradle-plugin:1.3.1-2.6"
//classpath 'com.jcraft:jsch:0.7.5'
classpath ('com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13') {
exclude group: 'xml-apis'
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
configurations {
//workaround for jmeter defect 57555 (https://bz.apache.org/bugzilla/show_bug.cgi?id=57555)
if (jmeterVersion == '2.12'){
compile.exclude group: 'excalibur-fortress', module: 'excalibur-fortress-container-api'
compile.exclude group: 'excalibur-fortress', module: 'excalibur-fortress-meta'
}
//workaround for jmeter defect 57748 (https://bz.apache.org/bugzilla/show_bug.cgi?id=57748)
if (jmeterVersion == '2.13'){
compile.exclude group: 'commons-math3', module: 'commons-math3'
compile.exclude group: 'commons-pool2', module: 'commons-pool2'
}
}
dependencies {
//common to all supported versions
compile gradleApi(),
localGroovy(),
"org.apache.ant:ant:1.8.4",
"org.beanshell:bsh-core:2.0b4",
"org.apache.jmeter:ApacheJMeter_http:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_junit:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_java:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_jdbc:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_tcp:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_mail:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_ldap:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_ftp:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_functions:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_monitors:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_jms:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_components:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_config:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_core:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_junit:${jmeterVersion}"
//version specific dependencies
if (jmeterVersion > '2.7') {
compile "org.apache.jmeter:ApacheJMeter_native:${jmeterVersion}"
}
if (jmeterVersion > '2.9'){
compile "org.apache.jmeter:ApacheJMeter_mongodb:${jmeterVersion}"
}
if (jmeterVersion < '2.13'){
compile "org.apache.jmeter:ApacheJMeter_report:${jmeterVersion}"
}
if (jmeterVersion > '2.9'){
compile "org.apache.jmeter:ApacheJMeter_components:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_config:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_junit-test:${jmeterVersion}",
"org.apache.jmeter:ApacheJMeter_mongodb:${jmeterVersion}"
}
if (jmeterVersion == '2.13'){
compile "org.apache.commons:commons-math3:3.4.1",
"org.apache.commons:commons-pool2:2.3"
}
testCompile "junit:junit:4.11"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
jmeterRun.configure {
jmeterTestFiles = [file("src/test/jmeter/performanceTestDITAllTests.jmx"), file("src/test/jmeter/performanceTestDIT.jmx"), file
("src/test/jmeter/functionalTestDIT.jmx")]
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
processResources.doLast {
ant.replace(
file: "${project.buildDir}/resources/main/jmeter-plugin.properties",
token: "@jmeter.version@",
value: "$jmeterVersion"
)
}
使用命令$ gradle clean时,得到以下错误。无法解决此问题。你能帮我解决这个问题。
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'JmeterGradle'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve jcharts:jcharts:0.7.5.
Required by:
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_mail:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_monitors:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_jdbc:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_ldap:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_config:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_core:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_functions:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_ftp:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_http:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_components:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_tcp:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_jms:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_junit:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_java:2.13
:JmeterGradle:unspecified > com.github.kulya:jmeter-gradle-plugin:1.3.4-2.13 > org.apache.jmeter:ApacheJMeter_mail:2.13 > org.
apache.jmeter:jorphan:2.13
> inconsistent module metadata found. Descriptor: jchart:jchart:0.7.5 Errors: bad group: expected='jcharts' found='jchart'
bad module name: expected='jcharts' found='jchart'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 51.637 secs
感谢您对此的帮助
答案 0 :(得分:1)
您的存储库中有一个错误的pom使用了jchart而不是jcharts。
请参阅: