File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1010apply plugin : ' java-library'
1111apply plugin : ' java'
1212apply plugin : ' eclipse'
13+ apply plugin : ' maven'
1314apply plugin : ' maven-publish'
1415
1516// In this section you declare where to find the dependencies of your project
@@ -53,3 +54,61 @@ task sourceJar(type: Jar) {
5354 from sourceSets. main. allJava
5455}
5556
57+ def getVersionCode () {
58+ return mavenMajorVersion. toInteger() * 10000 + mavenMinorVersion. toInteger() * 100 + mavenPatchVersion. toInteger()
59+ }
60+
61+ def getVersionName () {
62+ return " ${ mavenMajorVersion} .${ mavenMinorVersion} .${ mavenPatchVersion} "
63+ }
64+
65+ uploadArchives {
66+
67+ def bintrayUsername = " "
68+
69+ def bintrayApikey = " "
70+
71+ if (project. rootProject. file(' local.properties' ). exists()) {
72+
73+ Properties properties = new Properties ()
74+
75+ properties. load(project. rootProject. file(' local.properties' ). newDataInputStream())
76+
77+ bintrayUsername = properties. getProperty(' bintray.user' )
78+
79+ bintrayApikey = properties. getProperty(' bintray.apikey' )
80+
81+ }
82+
83+ configuration = configurations. archives
84+
85+ repositories. mavenDeployer {
86+
87+ pom {
88+
89+ setGroupId project. mavenGroupId
90+
91+ setArtifactId project. mavenArtifactId
92+
93+ setVersion getVersionName()
94+
95+ }
96+
97+ repository (url : project. mavenRepoUrl) {
98+
99+ authentication(
100+
101+ // put these values in local file ~/.gradle/gradle.properties
102+
103+ userName : project. hasProperty(" bintrayUsername" ) ? project. bintrayUsername : bintrayUsername,
104+
105+ password : project. hasProperty(" bintrayApikey" ) ? project. bintrayApikey : bintrayApikey
106+
107+ )
108+
109+ }
110+
111+ }
112+
113+ }
114+
You can’t perform that action at this time.
0 commit comments