Skip to content

Instantly share code, notes, and snippets.

@iam111
Created December 29, 2023 13:08
Show Gist options
  • Save iam111/c12b55397f3b9303f4ec58155ae40f64 to your computer and use it in GitHub Desktop.
Save iam111/c12b55397f3b9303f4ec58155ae40f64 to your computer and use it in GitHub Desktop.
plugins {
id 'com.android.library'
id 'maven-publish'
}
def artifactId = "artifactId"
def groupId = "com.example.groupId"
android {
namespace 'com.my.library'
compileSdk 31
defaultConfig {
minSdk 24
targetSdk 31
versionCode 4
versionName "1.0.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.7.6'
implementation 'androidx.navigation:navigation-ui:2.7.6'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
from components.release
setGroupId groupId
setArtifactId artifactId
version android.defaultConfig.versionName
}
}
repositories {
maven {
url "http://127.0.0.1:8081/repository/maven-releases/" //use the url what you've copied in nexus bashboard repository
credentials {
//here your nexus username and password will be used
username = 'admin'
password = '<your_nexus_password>'
}
allowInsecureProtocol = true // remove this line if you are using https:// instead of http://
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment