Create and Upload Test Framework as a Library
In this lesson, we will lear to create a framework jar and upload it to an artifactory.
We'll cover the following
Below is a guide to create a distribution RELEASE version of the automation library.
For demonstration, we will be using Gradle.
Tasks to be added in build.gradle
#
plugins {
id 'java'
}
group = 'com.educative.core-automation'
version = '1.0.0-RELEASE'
jar.baseName = 'ui-automation-lib'
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption("Xdoclint:none", "-quiet")
}
}
}
artifacts {
archives sourcesJar
archives javadocJar
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "<maven-url>") {
authentication(userName: "<username>", password: "<password>")
}
}
}
}
Generating the test Framework Jar #
After running the below command:
./gradlew clean build -x test
The project will be cleaned, compiled and the distribution jar will be created along with Javadoc and sources at ${project.dir}/build/libs
Get hands-on with 1400+ tech skills courses.