Reputation: 1
I have one test framework project which was created via Gradle/Idea, and since this project is one test framework project and all the test cases were located under the src/main/java folder.
sourceSets{
test{
java.srcDirs = ['src/main/java']
}
}
By Using gradle, I want to create one new task in build.gradle to run the specified testNG xml file via command line.
task runTest(type: Test){
useTestNG(){}
}
but always I got error like the below.
Error occurred during initialization of VM
java/lang/NoClassDefFoundError : java/lang/Object
Could anyone support this? Thanks a lot.
Upvotes: 0
Views: 501
Reputation: 7221
I understand that your tests are in main it is not ideal but well yes you can amend the default sourcesets.
sourceSets.test.java.srcDir 'src/main/java'
if you run it from IntelliJ you can add
idea.module {
testSourceDirs += file('src/main/java')
}
As intelliJ is not very good with stuff like gradle source sets.
About your error
Error occurred during initialization of VM
java/lang/NoClassDefFoundError : java/lang/Object
Is your PATH
/ JAVA_HOME
set? It seems like it might not be.
Upvotes: 1