1+ apply plugin : ' maven-publish'
2+ apply plugin : ' signing'
3+
4+
5+ group = PUBLISH_GROUP_ID
6+ version = PUBLISH_VERSION
7+
8+ ext[" ossrhUsername" ] = ' '
9+ ext[" ossrhPassword" ] = ' '
10+ ext[" signingKey" ] = ' '
11+ ext[" signingPassword" ] = ' '
12+
13+ File secretPropsFile = project. rootProject. file(' local.properties' )
14+ if (secretPropsFile. exists()) {
15+ Properties p = new Properties ()
16+ p. load(new FileInputStream (secretPropsFile))
17+ p. each { name , value -> ext[name] = value }
18+ }
19+
20+ task androidSourcesJar (type : Jar ) {
21+ archiveClassifier. set(' sources' )
22+ if (project. plugins. findPlugin(" com.android.library" )) {
23+ from android. sourceSets. main. java. srcDirs
24+ from android. sourceSets. main. kotlin. srcDirs
25+ } else {
26+ from sourceSets. main. java. srcDirs
27+ from sourceSets. main. kotlin. srcDirs
28+ }
29+ }
30+
31+ afterEvaluate {
32+ publishing {
33+ publications {
34+ release(MavenPublication ) {
35+ groupId PUBLISH_GROUP_ID
36+ artifactId PUBLISH_ARTIFACT_ID
37+ version PUBLISH_VERSION
38+
39+ from components. release
40+ artifact androidSourcesJar
41+
42+ pom {
43+ name = ' AndroidImageSlider Library'
44+ description = ' An amazing and convenient Android image slider.'
45+ url = ' https://github.com/chayanforyou/AndroidImageSlider'
46+
47+ licenses {
48+ license {
49+ name = ' MIT License'
50+ url = ' http://opensource.org/licenses/MIT'
51+ }
52+ }
53+ developers {
54+ developer {
55+ id = ' chayanforyou'
56+ name = ' Chayan Mistry'
57+ email = ' chayanforyou@yahoo.com'
58+ }
59+ }
60+ scm {
61+ connection = ' scm:git:git://github.com/chayanforyou/AndroidImageSlider.git'
62+ developerConnection = ' scm:git:ssh://github.com:chayanforyou/AndroidImageSlider.git'
63+ url = ' https://github.com/chayanforyou/AndroidImageSlider.git'
64+ }
65+ }
66+ }
67+ }
68+ repositories {
69+ maven {
70+ name = " sonatype"
71+
72+ def releasesRepoUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
73+ def snapshotsRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots/"
74+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
75+
76+ credentials {
77+ username ossrhUsername
78+ password ossrhPassword
79+ }
80+ }
81+ }
82+ }
83+
84+ signing {
85+ useInMemoryPgpKeys(signingKey, signingPassword)
86+ sign publishing. publications
87+ }
88+ }
0 commit comments