Skip to content

Commit

Permalink
Merge pull request #909 from an22/feature/migration-to-maven-publish
Browse files Browse the repository at this point in the history
Feature/migration to maven publish
  • Loading branch information
lynnik authored Apr 16, 2024
2 parents 6dd3bf4 + 4df4dfc commit 17fd3fe
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 57 deletions.
6 changes: 6 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# configuration file for building snapshots and releases with jitpack.io
jdk:
- openjdk11
before_install:
- sdk install java 11.0.10-open
- sdk use java 11.0.10-open
116 changes: 59 additions & 57 deletions mavenpush.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

def sonatypeRepositoryUrl
Expand All @@ -21,73 +20,76 @@ def getRepositoryPassword() {
return hasProperty('nexusPassword') ? nexusPassword : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.artifactId = POM_ARTIFACT_ID
tasks.register('androidJavadocs', Javadoc) {
source = android.sourceSets.main.java.sourceFiles
}

repository(url: sonatypeRepositoryUrl) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
tasks.register('androidJavadocsJar', Jar) {
classifier = 'javadoc'
//basename = artifact_id
from androidJavadocs.destinationDir
}

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
tasks.register('androidSourcesJar', Jar) {
classifier = 'sources'
//basename = artifact_id
from android.sourceSets.main.java.sourceFiles
}

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
publishing {
repositories {
maven {
url = sonatypeRepositoryUrl
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
publications {
maven(MavenPublication) {
afterEvaluate { project ->
from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
version = project.version
}

pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.sourceFiles
}
task androidJavadocsJar(type: Jar) {
classifier = 'javadoc'
//basename = artifact_id
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
//basename = artifact_id
from android.sourceSets.main.java.sourceFiles
}
signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("publishing") }
sign publishing.publications.maven
sign configurations.archives
}

artifacts {
//archives packageReleaseJar
archives androidSourcesJar
archives androidJavadocsJar
}
}*/

0 comments on commit 17fd3fe

Please sign in to comment.