2015-06-19 58 views
1

對於Jmeter-Gradle集成,我在下面創建了build.gradle文件並將其存儲在本地目錄中。執行gradle jmeter集成時出現Jcharts錯誤

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: "@[email protected]", 
      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

它對我沒有幫助。仍在努力解決這個問題 – Durgesh

回答

0

@UBIK負載組你指出正確的,他們可能錯了POM。

我也有同樣的問題,並通過添加jcenter(得到解決)mavenCentral()在倉庫阻止的build.gradle文件,這是工作。