been trying to generate Jar file of my existing Jetpack Compose project. I want to:
- Build jar file
- Upload that build to Jenkins Server.
I want to know, what is the correct way of doing it. I have been trying with this, but it still fails.
android {
namespace = "com.xxx.xxx"
compileSdk = 34
defaultConfig {
applicationId = "com.xxx.xxx"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
tasks.withType<Jar> {
enabled = true
manifest {
attributes["Main-Class"] = namespace
}
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.lifecycle.runtime.ktx)
...
}
// Task to create a JAR file
task createJar(type: Jar) {
archiveBaseName = 'mycomposeapp'
archiveVersion = '1.0.0'
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
Any help here, please?
Can set up Jenkins file, but what to do in build.gradle is what making me mad :(
createJar
task ?