Gradle Unit Test Failure

Hello,

In a mulitproject gradle build, I am unable to execute few JUnit test cases and error is :
java.lang.NoClassDefFoundError, java.lang.NoSuchMethodError etc…

I am actually migrating a huge project from Maven3 to Gradle. Codebase is in Java.
Compared the .class files for both Maven and Gradle, everything is same.
Build is happening properly for Gradle but Unit test case execution fails.

Maven is executing properly, why not Gradle???

Please help me out.

Probably the testCompile or testRuntime configuration of your project that is missing sth like mockito or junit.

Can you run with --stacktrace to get more info on what’s missing, and also post your build.gradle

Here is the build.gradle

apply plugin: 'java’
apply plugin: ‘maven’

group = 'com.rsa.ims’
version = ‘8.2.0.0.0-SNAPSHOT’

description = “”“IMS Command Server Engine Implementation (ims-cmd-server)”""

sourceCompatibility = 1.5
targetCompatibility = 1.5

configurations { providedCompile }
configurations.all {
}
sourceSets.main.java.srcDirs = [“src”]
repositories {

 maven { url "http://repo1.rsa.lab.emc.com:8081/artifactory/am-thirdparty" }

}
dependencies {
compile group: ‘com.rsa.ims’, name: ‘ims-app-core’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-authz-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-cache-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-certmgr-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-cmd-client’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-common’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-configmgt-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-coremgt-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-keymgr-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-license-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-logging’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-logging-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-registry-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘hibernate’, name: ‘hibernate’, version:'3.2.2’
compile group: ‘aopalliance’, name: ‘aopalliance’, version:'1.0’
compile group: ‘org.springframework’, name: ‘spring-aop’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-beans’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-context’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-core’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-jdbc’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-jms’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-orm’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-tx’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-web’, version:'3.0.3.RELEASE’
compile group: ‘commons-lang’, name: ‘commons-lang’, version:'2.2’
compile group: ‘commons-io’, name: ‘commons-io’, version:'2.2’
compile group: ‘commons-beanutils’, name: ‘commons-beanutils’, version:'1.8.3’
compile group: ‘commons-collections’, name: ‘commons-collections’, version:'3.2’
compile(group: ‘commons-validator’, name: ‘commons-validator’, version:‘1.3.0’) {
exclude(module: ‘xml-apis’)
}
compile group: ‘commons-logging’, name: ‘commons-logging’, version:'1.1.1’
compile group: ‘com.sun’, name: ‘ldapbp’, version:'1.0’
compile group: ‘log4j’, name: ‘log4j’, version:'1.2.12rsa-1’
compile group: ‘org.codehaus.groovy’, name: ‘groovy-all’, version:'1.8.3’
testCompile group: ‘hsqldb’, name: ‘hsqldb’, version:'2.2.4-jdk5’
testCompile group: ‘org.mockito’, name: ‘mockito-all’, version:'1.8.5’
testCompile group: ‘org.spockframework’, name: ‘spock-core’, version:'0.5-groovy-1.8’
testCompile group: ‘cglib’, name: ‘cglib’, version:'2.1_3’
testCompile group: ‘javassist’, name: ‘javassist’, version:'3.9.0.GA
testCompile group: ‘junit’, name: ‘junit’, version:'3.8.2’
testCompile group: ‘org.easymock’, name: ‘easymock’, version:'3.1’
testCompile group: ‘org.easymock’, name: ‘easymockclassextension’, version:'3.1’
testCompile group: ‘org.objenesis’, name: ‘objenesis’, version:'1.1’
testCompile group: ‘org.powermock’, name: ‘powermock-api-easymock’, version:'1.4.11’
testCompile group: ‘org.powermock’, name: ‘powermock-core’, version:'1.4.11’
testCompile group: ‘org.powermock’, name: ‘powermock-module-junit3’, version:'1.4.11’
testCompile group: ‘org.powermock’, name: ‘powermock-reflect’, version:'1.4.11’
testCompile group: ‘org.springframework’, name: ‘spring-test’, version:'3.0.3.RELEASE’
compile(group: ‘com.rsa.ims’, name: ‘ims-connmgr’, version:‘8.2.0.0.0-SNAPSHOT’) {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims’, name: ‘ims-security-providers’, version:‘8.2.0.0.0-SNAPSHOT’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims-segregated’, name: ‘ims-systemfields’, version:‘4.3.0.0.0’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims’, name: ‘ims-keymgr’, version:‘8.2.0.0.0-SNAPSHOT’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims’, name: ‘ims-registry’, version:‘8.2.0.0.0-SNAPSHOT’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘weblogic’, name: ‘weblogic-server-dependencies’, version:‘12.1.1.0’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘commonj’, name: ‘commonj-twm’, version:‘1.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘weblogic’, name: ‘javaee’, version:‘12.1.1.0’) {
exclude(module: ‘javax.xml.stream’)
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.bsafe’, name: ‘certj’, version:‘6.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.bsafe’, name: ‘cryptoj’, version:‘6.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.bsafe’, name: ‘sslj’, version:‘6.1.0.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xalan’, name: ‘serializer’, version:‘2.7.0’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xalan’, name: ‘xalan’, version:‘2.7.0’) {
exclude(module: ‘xml-apis’)
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xml-apis’, name: ‘xml-apis’, version:‘1.4.01-r1445299’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xerces’, name: ‘xercesImpl’, version:‘2.8.1’) {
exclude(module: ‘xml-apis’)
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
}
sourceSets.test.java.srcDirs = [“test”]

test {

filter {
    //include specific method in any of the tests
    includeTestsMatching "*CommandServerEngineMaskTest"
	includeTestsMatching "*TransactionalCommandTest"
	includeTestsMatching "*BatchJobTXEngineTest"
	includeTestsMatching "*BatchJobProcessorImplTest"
	includeTestsMatching "*OldBatchJobDeserializationTest"
	includeTestsMatching "*PrimaryInstanceURLProviderTest"
   
}
testLogging {
	// Show that tests are run in the command-line output
	events 'started', 'passed'
}

}

stack trace is a very large file… Part of the file is here

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:test’.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExe

Build.Gradle File is here::::::

apply plugin: 'java’
apply plugin: ‘maven’

group = 'com.rsa.ims’
version = ‘8.2.0.0.0-SNAPSHOT’

description = “”“IMS Command Server Engine Implementation (ims-cmd-server)”""

sourceCompatibility = 1.5
targetCompatibility = 1.5

configurations { providedCompile }
configurations.all {
}
sourceSets.main.java.srcDirs = [“src”]
repositories {

 maven { url "http://repo1.rsa.lab.emc.com:8081/artifactory/am-thirdparty" }

}
dependencies {
compile group: ‘com.rsa.ims’, name: ‘ims-app-core’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-authz-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-cache-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-certmgr-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-cmd-client’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-common’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-configmgt-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-coremgt-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-keymgr-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-license-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-logging’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-logging-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘com.rsa.ims’, name: ‘ims-registry-api’, version:'8.2.0.0.0-SNAPSHOT’
compile group: ‘hibernate’, name: ‘hibernate’, version:'3.2.2’
compile group: ‘aopalliance’, name: ‘aopalliance’, version:'1.0’
compile group: ‘org.springframework’, name: ‘spring-aop’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-beans’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-context’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-core’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-jdbc’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-jms’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-orm’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-tx’, version:'3.0.3.RELEASE’
compile group: ‘org.springframework’, name: ‘spring-web’, version:'3.0.3.RELEASE’
compile group: ‘commons-lang’, name: ‘commons-lang’, version:'2.2’
compile group: ‘commons-io’, name: ‘commons-io’, version:'2.2’
compile group: ‘commons-beanutils’, name: ‘commons-beanutils’, version:'1.8.3’
compile group: ‘commons-collections’, name: ‘commons-collections’, version:'3.2’
compile(group: ‘commons-validator’, name: ‘commons-validator’, version:‘1.3.0’) {
exclude(module: ‘xml-apis’)
}
compile group: ‘commons-logging’, name: ‘commons-logging’, version:'1.1.1’
compile group: ‘com.sun’, name: ‘ldapbp’, version:'1.0’
compile group: ‘log4j’, name: ‘log4j’, version:'1.2.12rsa-1’
compile group: ‘org.codehaus.groovy’, name: ‘groovy-all’, version:'1.8.3’
testCompile group: ‘hsqldb’, name: ‘hsqldb’, version:'2.2.4-jdk5’
testCompile group: ‘org.mockito’, name: ‘mockito-all’, version:'1.8.5’
testCompile group: ‘org.spockframework’, name: ‘spock-core’, version:'0.5-groovy-1.8’
testCompile group: ‘cglib’, name: ‘cglib’, version:'2.1_3’
testCompile group: ‘javassist’, name: ‘javassist’, version:'3.9.0.GA
testCompile group: ‘junit’, name: ‘junit’, version:'3.8.2’
testCompile group: ‘org.easymock’, name: ‘easymock’, version:'3.1’
testCompile group: ‘org.easymock’, name: ‘easymockclassextension’, version:'3.1’
testCompile group: ‘org.objenesis’, name: ‘objenesis’, version:'1.1’
testCompile group: ‘org.powermock’, name: ‘powermock-api-easymock’, version:'1.4.11’
testCompile group: ‘org.powermock’, name: ‘powermock-core’, version:'1.4.11’
testCompile group: ‘org.powermock’, name: ‘powermock-module-junit3’, version:'1.4.11’
testCompile group: ‘org.powermock’, name: ‘powermock-reflect’, version:'1.4.11’
testCompile group: ‘org.springframework’, name: ‘spring-test’, version:'3.0.3.RELEASE’
compile(group: ‘com.rsa.ims’, name: ‘ims-connmgr’, version:‘8.2.0.0.0-SNAPSHOT’) {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims’, name: ‘ims-security-providers’, version:‘8.2.0.0.0-SNAPSHOT’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims-segregated’, name: ‘ims-systemfields’, version:‘4.3.0.0.0’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims’, name: ‘ims-keymgr’, version:‘8.2.0.0.0-SNAPSHOT’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.ims’, name: ‘ims-registry’, version:‘8.2.0.0.0-SNAPSHOT’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘weblogic’, name: ‘weblogic-server-dependencies’, version:‘12.1.1.0’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘commonj’, name: ‘commonj-twm’, version:‘1.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘weblogic’, name: ‘javaee’, version:‘12.1.1.0’) {
exclude(module: ‘javax.xml.stream’)
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.bsafe’, name: ‘certj’, version:‘6.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.bsafe’, name: ‘cryptoj’, version:‘6.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘com.rsa.bsafe’, name: ‘sslj’, version:‘6.1.0.1’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xalan’, name: ‘serializer’, version:‘2.7.0’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xalan’, name: ‘xalan’, version:‘2.7.0’) {
exclude(module: ‘xml-apis’)
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xml-apis’, name: ‘xml-apis’, version:‘1.4.01-r1445299’) {
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: ‘xerces’, name: ‘xercesImpl’, version:‘2.8.1’) {
exclude(module: ‘xml-apis’)
/
This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
}
sourceSets.test.java.srcDirs = [“test”]

test {

filter {
    //include specific method in any of the tests
    includeTestsMatching "*CommandServerEngineMaskTest"
	includeTestsMatching "*TransactionalCommandTest"
	includeTestsMatching "*BatchJobTXEngineTest"
	includeTestsMatching "*BatchJobProcessorImplTest"
	includeTestsMatching "*OldBatchJobDeserializationTest"
	includeTestsMatching "*PrimaryInstanceURLProviderTest"
   
}
testLogging {
	// Show that tests are run in the command-line output
	events 'started', 'passed'
}

}

Not usable :disappointed:
Maybe you can use an online pasting service (github’s gist?) to show us the full stacktrace. I’m looking for a “caused by” section

Please find the below link

https://gist.github.com/Niranjan123456/3cacc6360bcdaa275052

Sorry I misunderstood you. I thought it was a test compilation issue, not a test execution issue.

In the test execution report (file:///C:/p4/dev/am-main/ims/components/ims-cmd-server/bu
sts/index.html) , what’s the stacktrace for the failing test?

Its giving a vague error saying that It could not find some class as I said in my 1st question…

But the thing is the same code is getting compiled and tested in Maven without any problems…

What may be the reason???

What happens is that the testRuntime configuration is missing the class. The testRuntime extends the testCompile configuration, but you can add dependencies with the sole purpose of running tests.
Without seeing the NoClassDef exception, I cannot guess further what this class /dependency it might be.

If this works in Maven but not Gradle, it’s probably because your mapping between your old maven dependencies and their transitive dependencies is not correct in Gradle

I tried testRuntime, its giving errors.

Html file is shared in below location
https://gist.github.com/Niranjan123456/98d95d403a9ab9be1ff2

java.lang.NoClassDefFoundError: org/easymock/internal/ClassProxyFactory$2

Looks like the easymock dependency being used is not the one you specified. Probably due to a conflict resolution not choosing your dependency.

java.lang.NoSuchMethodError: org/objectweb/asm/ClassWriter.(Z)V
Same thing with asm

You really have a lot of dependencies. Gradle might not choose the same version as maven to resolve any potential conflict between dependencies.

You could execute
gradle dependencies --configuration testCompile
And
gradle dependencyInsight

To know for sure what version is taken, and from which branch on your dependencies tree

Checked the versions… everything is same…

However there is some xml file in the jar generated from Maven ,which is not there in the Gradle jar…

Any idea???