# How to build Selenium TestNG project into an executable JAR with dependencies in Gradle?

**URL:** <https://discuss.gradle.org/t/how-to-build-selenium-testng-project-into-an-executable-jar-with-dependencies-in-gradle/37616>\
**Category:** Help/Discuss\
**Created:** [September 17, 2020, 12:47am UTC](https://discuss.gradle.org/t/how-to-build-selenium-testng-project-into-an-executable-jar-with-dependencies-in-gradle/37616 "2020-09-17T00:47:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![navanithhv](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@navanithhv](https://discuss.gradle.org/u/navanithhv)\
**Post date:** [September 17, 2020, 12:47am UTC](https://discuss.gradle.org/t/how-to-build-selenium-testng-project-into-an-executable-jar-with-dependencies-in-gradle/37616/1 "2020-09-17T00:47:40Z")

</div>

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?

```gradle
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')    
}

```

 ![GradleProject](https://global.discourse-cdn.com/gradle/original/2X/a/af8349d5462e79edd5dff439b5f19a92f35350d2.png)
