Skip to content

Commit 61ab700

Browse files
committed
fix readme file, make the project deployable to the maven central repository
1 parent 1f5abf1 commit 61ab700

File tree

4 files changed

+100
-35
lines changed

4 files changed

+100
-35
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Add the Maven dependency:
1919

2020
```xml
2121
<dependency>
22-
<groupId>io.zonky</groupId>
22+
<groupId>io.zonky.test</groupId>
2323
<artifactId>embedded-database-spring-test</artifactId>
2424
<version>1.0.0</version>
2525
<scope>test</scope>
@@ -110,13 +110,13 @@ public class FlywayMigrationIntegrationTest {
110110
```
111111

112112
## Building from Source
113-
The project uses a [Gradle][]-based build system. In the instructions
114-
below, [`./gradlew`][] is invoked from the root of the source tree and serves as
113+
The project uses a [Gradle](http://gradle.org)-based build system. In the instructions
114+
below, [`./gradlew`](http://vimeo.com/34436402) is invoked from the root of the source tree and serves as
115115
a cross-platform, self-contained bootstrap mechanism for the build.
116116

117117
### Prerequisites
118118

119-
[Git][] and [JDK 8 or later][JDK8 build]
119+
[Git](http://help.github.com/set-up-git-redirect) and [JDK 8 or later](http://www.oracle.com/technetwork/java/javase/downloads)
120120

121121
Be sure that your `JAVA_HOME` environment variable points to the `jdk1.8.0` folder
122122
extracted from the JDK download.
@@ -139,4 +139,4 @@ extracted from the JDK download.
139139
* [Guava](https://github.com/google/guava) (23.0)
140140

141141
## License
142-
The project is released under version 2.0 of the [Apache License][].
142+
The project is released under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0.html).

build.gradle

Lines changed: 94 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
import java.util.regex.Matcher
12

23
plugins {
34
id 'net.researchgate.release' version '2.6.0'
45
}
56

6-
// it's a workaround for https://github.com/researchgate/gradle-release/issues/186
7-
task build(dependsOn: [':embedded-database-spring-test-core:build', ':embedded-database-spring-test-main:build'])
7+
ext {
8+
ossrhUsername = project.findProperty('ossrhUsername')
9+
ossrhPassword = project.findProperty('ossrhPassword')
10+
}
811

912
allprojects {
10-
group 'io.zonky'
13+
group 'io.zonky.test'
1114
}
1215

1316
subprojects {
1417
apply plugin: 'java'
1518
apply plugin: 'maven'
16-
apply plugin: 'maven-publish'
19+
apply plugin: 'signing'
1720

1821
sourceCompatibility = 1.8
1922

@@ -42,42 +45,96 @@ subprojects {
4245
useJUnit()
4346
}
4447

45-
task sourcesJar(type: Jar, dependsOn: classes) {
48+
task sourcesJar(type: Jar) {
4649
classifier = 'sources'
4750
from sourceSets.main.allSource
4851
}
4952

50-
task javadocJar(type: Jar, dependsOn: javadoc) {
53+
task javadocJar(type: Jar) {
5154
classifier = 'javadoc'
52-
from javadoc.destinationDir
55+
from javadoc
5356
}
5457

55-
publishing {
56-
publications {
57-
mavenJava(MavenPublication) {
58-
from components.java
59-
artifact sourcesJar
60-
artifact javadocJar
61-
}
62-
all {
63-
pom.withXml {
64-
asNode().dependencies.'*'.findAll() {
65-
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
66-
dep.name == it.artifactId.text()
58+
artifacts {
59+
archives javadocJar, sourcesJar
60+
}
61+
62+
signing {
63+
required { gradle.taskGraph.hasTask("uploadArchives") }
64+
sign configurations.archives
65+
}
66+
67+
uploadArchives {
68+
repositories {
69+
mavenDeployer {
70+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
71+
72+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
73+
authentication(userName: ossrhUsername, password: ossrhPassword)
74+
}
75+
76+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
77+
authentication(userName: ossrhUsername, password: ossrhPassword)
78+
}
79+
80+
pom.project {
81+
name 'embedded-database-spring-test'
82+
packaging 'jar'
83+
description 'A library for creating isolated embedded databases for Spring-powered integration tests.'
84+
url 'https://github.com/zonkyio/embedded-database-spring-test'
85+
86+
scm {
87+
connection 'scm:git:git://github.com/zonkyio/embedded-database-spring-test.git'
88+
developerConnection 'scm:git:ssh://github.com:zonkyio/embedded-database-spring-test.git'
89+
url 'https://github.com/zonkyio/embedded-database-spring-test/tree/master'
90+
}
91+
92+
licenses {
93+
license {
94+
name 'The Apache License, Version 2.0'
95+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
96+
}
97+
}
98+
99+
developers {
100+
developer {
101+
name 'Roman Pichlik'
102+
103+
}
104+
developer {
105+
name 'Tomas Vanek'
106+
107+
}
108+
developer {
109+
name 'Developers Zonky'
110+
67111
}
68-
}.each { it.scope*.value = 'compile'}
112+
}
69113
}
70114
}
71115
}
72116
}
73117

74118
release {
119+
tagTemplate = 'v${version}'
120+
versionPatterns = [
121+
// increments the minor version: "1.0.0-SNAPSHOT" => "1.1.0-SNAPSHOT"
122+
/(\d+)\.\d+([^\d]*$)/: { Matcher m, Project p -> m.replaceAll("${(m[0][1] as int) + 1}.0${m[0][2]}") }
123+
]
75124
git {
76125
requireBranch = '^(master|\\d+\\.\\d+\\.x)$'
77126
}
78127
}
79128
}
80129

130+
project(':embedded-database-spring-test-autoconfigure') {
131+
archivesBaseName = 'embedded-database-spring-test'
132+
133+
dependencies {
134+
compile project(':embedded-database-spring-test-core')
135+
}
136+
}
137+
81138
project(':embedded-database-spring-test-core') {
82139
dependencies {
83140
compile 'org.springframework:spring-context:4.3.10.RELEASE'
@@ -88,16 +145,24 @@ project(':embedded-database-spring-test-core') {
88145
}
89146
}
90147

91-
project(':embedded-database-spring-test-main') {
92-
dependencies {
93-
compile project(':embedded-database-spring-test-core')
148+
task updateReadmeVersion() {
149+
doLast {
150+
def version = project.version.toString()
151+
ant.replaceregexp(file: 'README.md', match: '<version>\\d+\\.\\d+\\.\\d+</version>', replace: "<version>$version</version>", flags: 'g', byline: true)
94152
}
153+
}
95154

96-
publishing {
97-
publications {
98-
mavenJava(MavenPublication) {
99-
artifactId 'embedded-database-spring-test'
100-
}
101-
}
155+
// workaround for https://github.com/researchgate/gradle-release/issues/186
156+
task build(group: 'build') {
157+
subprojects.each {
158+
dependsOn "${it.path}:build"
159+
}
160+
}
161+
162+
runBuildTasks.dependsOn updateReadmeVersion
163+
164+
afterReleaseBuild {
165+
subprojects.each {
166+
dependsOn "${it.path}:uploadArchives"
102167
}
103168
}

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rootProject.name = 'embedded-database-spring-test'
22

33
include 'embedded-database-spring-test-core'
4-
include 'embedded-database-spring-test-main'
4+
include 'embedded-database-spring-test-autoconfigure'

0 commit comments

Comments
 (0)