Skip to content

Commit 08c6335

Browse files
committed
Maven publishing.
1 parent df29214 commit 08c6335

File tree

6 files changed

+163
-18
lines changed

6 files changed

+163
-18
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ ActiveAndroid is an active record style ORM ([object relational mapper](http://e
55

66
ActiveAndroid does so much more than this though. Accessing the database is a hassle, to say the least, in Android. ActiveAndroid takes care of all the setup and messy stuff, and all with just a few simple steps of configuration.
77

8+
## Download
9+
10+
Grab via Maven:
11+
```xml
12+
<dependency>
13+
<groupId>com.michaelpardo</groupId>
14+
<artifactId>activeandroid</artifactId>
15+
<version>3.1.0-SNAPSHOT</version>
16+
</dependency>
17+
```
18+
or Gradle:
19+
```groovy
20+
repositories {
21+
mavenCentral()
22+
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
23+
}
24+
25+
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
26+
```
27+
828
## Documentation
929

1030
* [Getting started](http://github.com/pardom/ActiveAndroid/wiki/Getting-started)

build.gradle

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
apply plugin: 'java'
2+
apply from: 'gradle-mvn-push.gradle'
23

3-
sourceCompatibility = 1.6
4-
5-
jar.baseName = 'activeandroid'
6-
archivesBaseName = 'activeandroid'
4+
targetCompatibility = '1.6'
5+
sourceCompatibility = '1.6'
76

87
sourceSets {
98
main {
@@ -16,12 +15,3 @@ sourceSets {
1615
dependencies {
1716
compile fileTree(dir: 'libs', include: '*.jar')
1817
}
19-
20-
task sourcesJar(type: Jar) {
21-
classifier = 'sources'
22-
from sourceSets.main.allSource
23-
}
24-
25-
artifacts {
26-
archives sourcesJar
27-
}

gradle-mvn-push.gradle

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*
2+
* Copyright 2013 Chris Banes
3+
* Copyright 2014 Michael Pardo
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
apply plugin: 'maven'
19+
apply plugin: 'signing'
20+
21+
def isReleaseBuild() {
22+
return VERSION_NAME.contains("SNAPSHOT") == false
23+
}
24+
25+
def getReleaseRepositoryUrl() {
26+
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
27+
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
28+
}
29+
30+
def getSnapshotRepositoryUrl() {
31+
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
32+
: "https://oss.sonatype.org/content/repositories/snapshots/"
33+
}
34+
35+
def getRepositoryUsername() {
36+
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
37+
}
38+
39+
def getRepositoryPassword() {
40+
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
41+
}
42+
43+
afterEvaluate { project ->
44+
uploadArchives {
45+
repositories {
46+
mavenDeployer {
47+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
48+
49+
pom.groupId = GROUP
50+
pom.artifactId = POM_ARTIFACT_ID
51+
pom.version = VERSION_NAME
52+
53+
repository(url: getReleaseRepositoryUrl()) {
54+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
55+
}
56+
snapshotRepository(url: getSnapshotRepositoryUrl()) {
57+
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
58+
}
59+
60+
pom.project {
61+
name POM_NAME
62+
packaging POM_PACKAGING
63+
description POM_DESCRIPTION
64+
url POM_URL
65+
66+
scm {
67+
url POM_SCM_URL
68+
connection POM_SCM_CONNECTION
69+
developerConnection POM_SCM_DEV_CONNECTION
70+
}
71+
72+
licenses {
73+
license {
74+
name POM_LICENCE_NAME
75+
url POM_LICENCE_URL
76+
distribution POM_LICENCE_DIST
77+
}
78+
}
79+
80+
developers {
81+
developer {
82+
id POM_DEVELOPER_ID
83+
name POM_DEVELOPER_NAME
84+
}
85+
}
86+
}
87+
}
88+
}
89+
}
90+
91+
signing {
92+
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
93+
sign configurations.archives
94+
}
95+
96+
task javadocs(type: Javadoc) {
97+
source = sourceSets.main.allJava
98+
classpath = configurations.compile
99+
}
100+
101+
task javadocsJar(type: Jar, dependsOn: javadocs) {
102+
classifier = 'javadoc'
103+
from javadocs.destinationDir
104+
}
105+
106+
task sourcesJar(type: Jar) {
107+
classifier = 'sources'
108+
from sourceSets.main.allJava
109+
}
110+
111+
artifacts {
112+
archives sourcesJar
113+
archives javadocsJar
114+
}
115+
}

gradle.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
VERSION_NAME=3.1.0-SNAPSHOT
2+
VERSION_CODE=1
3+
GROUP=com.michaelpardo
4+
5+
POM_DESCRIPTION=Active record style SQLite persistence for Android.
6+
POM_URL=https://github.com/pardom/ActiveAndroid
7+
POM_SCM_URL=https://github.com/pardom/ActiveAndroid
8+
POM_SCM_CONNECTION=scm:[email protected]:pardom/ActiveAndroid.git
9+
POM_SCM_DEV_CONNECTION=scm:[email protected]:pardom/ActiveAndroid.git
10+
POM_LICENCE_NAME=The Apache Software License, Version 2.0
11+
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
12+
POM_LICENCE_DIST=repo
13+
POM_DEVELOPER_ID=michaelpardo
14+
POM_DEVELOPER_NAME=Michael Pardo
15+
16+
POM_NAME=ActiveAndroid
17+
POM_ARTIFACT_ID=activeandroid
18+
POM_PACKAGING=jar

src/com/activeandroid/util/IOUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
public class IOUtils {
2929

3030
/**
31+
* <p>
3132
* Unconditionally close a {@link Closeable}.
32-
* <p/>
33+
* </p>
3334
* Equivalent to {@link Closeable#close()}, except any exceptions will be ignored. This is
3435
* typically used in finally blocks.
3536
* @param closeable A {@link Closeable} to close.
@@ -48,8 +49,9 @@ public static void closeQuietly(final Closeable closeable) {
4849
}
4950

5051
/**
52+
* <p>
5153
* Unconditionally close a {@link Cursor}.
52-
* <p/>
54+
* </p>
5355
* Equivalent to {@link Cursor#close()}, except any exceptions will be ignored. This is
5456
* typically used in finally blocks.
5557
* @param cursor A {@link Cursor} to close.

src/com/activeandroid/widget/ModelAdapter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public ModelAdapter(Context context, int resource, int textViewResourceId, List<
2727

2828
/**
2929
* Clears the adapter and, if data != null, fills if with new Items.
30-
*
31-
* @param collection A Collection<? extends T> which members get added to the adapter.
30+
*
31+
* @param collection A Collection&lt;? extends T&gt; which members get added to the adapter.
3232
*/
3333
public void setData(Collection<? extends T> collection) {
3434
clear();
@@ -54,4 +54,4 @@ public long getItemId(int position) {
5454
return -1;
5555
}
5656
}
57-
}
57+
}

0 commit comments

Comments
 (0)