大佬教程收集整理的这篇文章主要介绍了无法在groovy gradle中创建AntBuilder对象,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) at java.lang.Class.getDeclaredConstructors(Class.java:1901) ..... at at features.step_deFinitions.ReWARDEventsGeneration.GetEventXML(ReWARDEventsGeneration.groovy:40)
我已将相关的jar@L_801_3@到我的lib文件夹中,然后放在build.gradle下的代码下面
repositories { mavenCentral() flatDir { dirs 'lib' } }
我的代码如下
def GetEventXML (userId,eventTypeIn) { def Host = "10.77.69.14" def UserName = "system" def password = "password" def Path = "/temp" def eventTypeToLookFor = "eventType=\"$eventTypeIn\"" def resultAsString = "" as String def commandToRun = "grep -lH $userId $Path/*.xml | xargs grep -l '$eventTypeToLookFor' | cut -d: -f1" def antEventcheck = new AntBuilder(); ********** Error line ****************** antEventcheck.sshexec( trust:'true',host:Host,username:UserName,password:password,command:commandToRun,verbose:'true',timeout:'10000',failonerror:'false',outputproperty:'eventcheckResult'); resultAsString = antEventcheck.properties.eventcheckResult.toString() return resultAsString }
的build.gradle
dependencies { ext.groovyVersion = "2.0.4" ext.cucumberJvmVersion = "1.1.5" ext.httpclientVersion = "4.2.1" cucumberRuntime files("${jar.archivePath}") compile ('com.jcraft:jsch:0.1.49') compile('com.github.groovy-wslite:groovy-wslite:0.8.0') groovy("org.codehaus.groovy:groovy-all:${groovyVersion}") compile("org.apache.httpcomponents:httpR_886_11845@ime:4.1.2") compile("org.codehaus.groovy.modules.http-builder:http-builder:0.5.2") { exclude group: "org.codehaus.groovy",module: "groovy" } compile("net.sf.json-lib:json-lib:2.4:jdk15") compile("javax.mail:mail:1.4.5") compile("org.apache.httpcomponents:httpclient:${httpclientVersion}") compile("org.codehaus.geb:geb-core:0.7.2") { exclude group: "org.codehaus.geb",module: "geb-implicit-assertions" } drivers.each { driver -> TESTCompile "org.SELEniumhq.SELEnium:SELEnium-$driver-driver:$version.SELEnium" } compile("org.SELEniumhq.SELEnium:SELEnium-support:2.25.0") compile("log4j:log4j:1.2.17") TESTCompile("junit:junit:4.10") TESTCompile("info.cukes:cucumber-groovy:${CucumberJvmVersion}") TESTCompile("info.cukes:cucumber-junit:${CucumberJvmVersion}") }
感谢您的评论
以上是大佬教程为你收集整理的无法在groovy gradle中创建AntBuilder对象全部内容,希望文章能够帮你解决无法在groovy gradle中创建AntBuilder对象所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。