I am trying to build my Selenium TestNG project into an executable JAR with project dependencies in the Gradle so that I can run my tests anywhere but I am not finding a proper way. Tests run fine on the command line with gradle test command. I have attached my project structure screenshot and my gradle.build file. Someone, please advise what are all the changes I need to make in the gradle.build file and to the project structure to generate executable JAR with project dependencies?
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
downloadSources=true
}
}
test {
useTestNG() {
suites 'src/test/java/resources/testng.xml'
}
reports.junitXml.destination = file("$buildDir/test-output/")
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
}
repositories {
jcenter()
mavenCentral()
maven {
url "https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java"
}
maven {
url "https://mvnrepository.com/artifact/commons-io/commons-io"
}
maven {
url "http://gradle.artifactoryonline.com/gradle/libs/"
}
maven {
url "http://gradle.artifactoryonline.com/gradle/libs/"
}
}
dependencies {
compile group: 'org.testng', name: 'testng', version: '6.10'
testImplementation 'junit:junit:4.12'
testImplementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.11.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'
compile files('libs/tmc-qa-page-interactions.jar')
}