Skip to content

Commit 35f0b54

Browse files
Replace Maven with Gradle (#54)
1 parent d51094d commit 35f0b54

File tree

24 files changed

+670
-563
lines changed

24 files changed

+670
-563
lines changed

.ci/deploy-snapshots.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
if [ "$CI" != "true" ]
4+
then
5+
echo "Not a CI build"
6+
exit 1
7+
fi
8+
9+
if ! [[ $TRAVIS_REPO_SLUG =~ benjamin-bader/droptools ]]
10+
then
11+
echo "Wrong repo"
12+
exit 1
13+
fi
14+
15+
if [ "$TRAVIS_BRANCH" != "master" ]
16+
then
17+
echo "Wrong branch"
18+
exit 1
19+
fi
20+
21+
if [ "$TRAVIS_PULL_REQUEST" != "false" ]
22+
then
23+
echo "Pull request"
24+
exit 1
25+
fi
26+
27+
if [ ! -z $(awk '/^VERSION=/ && !/SNAPSHOT$/' gradle.properties) ]
28+
then
29+
echo "Not a snapshot"
30+
exit 1
31+
fi
32+
33+
./gradlew uploadArchives

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ dependency-reduced-pom.xml
1717

1818
# Misc
1919
logs/
20+
21+
# Gradle
22+
.gradle/
23+
build/

.java-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,25 @@ before_script:
55
- psql -d example_app -U postgres -f droptools-example/src/main/resources/db/migration/20141010__init.sql
66
- psql -c "grant all on database example_app to example_user;" -U postgres
77
- psql -c "grant all on all tables in schema ex to example_user" -d example_app -U postgres
8-
install: echo 'mvn test will install dependencies for us'
9-
script: mvn test
10-
after_success: mvn -DperformRelease=true cobertura:cobertura coveralls:cobertura
8+
install: echo './gradlew check will install dependencies for us'
9+
script: ./gradlew --parallel check codeCoverageReport
10+
after_success:
11+
- .ci/deploy-snapshots.sh
12+
- SONATYPE_USERNAME= SONATYPE_PASSWORD= bash <(curl -s https://codecov.io/bash)
1113
jdk:
1214
- oraclejdk8
1315
sudo: false
1416
cache:
1517
directories:
16-
- $HOME/.m2
18+
- "$HOME/.gradle/caches/"
19+
- "$HOME/.gradle/wrapper/"
1720
addons:
18-
postgresql: "9.3"
21+
postgresql: '9.3'
22+
apt:
23+
packages:
24+
- oracle-java8-installer
25+
env:
26+
global:
27+
- secure: ZatHIH8EqbIJnM3s3E1rftA9N+qB1iwP7fGvkLAomd19fHkEEOt/6mowz5JuguZDre9pYX3BlvmSNMxrNOjqDyEg6iLeARFIN3K84l1f6q5CyizFltgMq+a5WfUDrrNkrXTvW32oFJIU4u72QDNjrISn6jDQdZQUC5dcnZokEAk=
28+
- secure: b4ZuEazC2EalpE6nyfFWiMbUJvjh9AYpFfsp30KkFto5t/UFhorurfJKQuj4erAVN/9xyjm9bKdmA0ggX2JrfRop9ZpAq4vHfdDYb5jFnH+CVWirPbosDQ9sQNeBcbHoRWi98SK3YwZZCoAWL4Zb7wi5wKv+0WimIq0NjWoK3Lc=
29+
- secure: C/kf7l2DWgyBkXGNVofsacQ3yxF+X7G0DJa4oc5befxFhvf/yxZHs6OD3crWUxYFRvP9oxZNP67oKmVptT8w8rXifhf92z1PYX8Wbd4/X50k7JG6e86k3GdiMfgVoso0sjoA267167Mf/JMzB7uurWHvQlhKBdLpwEnIV9U8i5Y=

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Please file bug reports and feature requests in [GitHub issues](https://github.c
4242
License
4343
-------
4444

45-
Copyright (c) 2014-2017 Benjamin Bader
45+
Copyright (c) 2014-2019 Benjamin Bader
4646

4747
This library is licensed under the Apache License, Version 2.0.
4848

build.gradle

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
allprojects {
2+
repositories {
3+
mavenCentral()
4+
}
5+
6+
group GROUP
7+
version VERSION
8+
9+
project.ext {
10+
dropwizardVersion = "1.3.5"
11+
coberaturaVersion = "2.7"
12+
jooqVersion = "3.11.3"
13+
jedisVersion = "2.9.0"
14+
15+
libs = [
16+
testing: [
17+
"junit:junit:4.12",
18+
"org.mockito:mockito-all:1.9.5",
19+
dependencies.create("com.google.truth:truth:0.23") {
20+
exclude module: "guava"
21+
},
22+
],
23+
24+
dropwizardDb: "io.dropwizard:dropwizard-db:$dropwizardVersion",
25+
jooq: "org.jooq:jooq:$jooqVersion",
26+
27+
dropwizardCore: "io.dropwizard:dropwizard-core:$dropwizardVersion",
28+
jedis: "redis.clients:jedis:$jedisVersion",
29+
]
30+
}
31+
}
32+
33+
buildscript {
34+
repositories {
35+
mavenCentral()
36+
maven {
37+
url "https://plugins.gradle.org/m2/"
38+
}
39+
}
40+
}
41+
42+
subprojects { sp ->
43+
apply plugin: "java-library"
44+
apply plugin: "idea"
45+
apply plugin: "jacoco"
46+
47+
sourceCompatibility = "1.8"
48+
targetCompatibility = "1.8"
49+
50+
tasks.withType(JavaCompile) {
51+
options.fork = true
52+
options.incremental = true
53+
}
54+
55+
test {
56+
testLogging {
57+
events "failed"
58+
exceptionFormat "full"
59+
showStackTraces true
60+
showExceptions true
61+
showCauses true
62+
}
63+
}
64+
}
65+
66+
apply plugin: "jacoco"
67+
68+
task codeCoverageReport(type: JacocoReport) {
69+
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
70+
71+
subprojects.each {
72+
sourceSets it.sourceSets.main
73+
}
74+
75+
reports {
76+
xml.enabled = true
77+
xml.destination file("$buildDir/reports/jacoco/report.xml")
78+
html.enabled = true
79+
csv.enabled = false
80+
}
81+
}
82+
83+
codeCoverageReport.dependsOn {
84+
subprojects*.test
85+
}
86+
87+
afterEvaluate {
88+
subprojects {
89+
apply from: file("$rootDir/gradle/gradle-mvn-push.gradle")
90+
}
91+
}
92+
93+
wrapper {
94+
gradleVersion = "5.4"
95+
distributionType = Wrapper.DistributionType.ALL
96+
}

droptools-example/build.gradle

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
description = "blah"
2+
3+
buildscript {
4+
repositories {
5+
maven {
6+
url "https://plugins.gradle.org/m2/"
7+
}
8+
}
9+
10+
dependencies {
11+
classpath "nu.studer:gradle-jooq-plugin:3.0.3"
12+
classpath "com.github.jengelman.gradle.plugins:shadow:5.0.0"
13+
}
14+
}
15+
16+
apply plugin: "application"
17+
apply plugin: "nu.studer.jooq"
18+
apply plugin: "com.github.johnrengelman.shadow"
19+
20+
uploadArchives.enabled = false
21+
22+
mainClassName = "com.bendb.example.ExampleApp"
23+
24+
run {
25+
args "server", "$projectDir/config/dev.yml"
26+
}
27+
28+
shadowJar {
29+
mergeServiceFiles()
30+
exclude 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.SF'
31+
}
32+
33+
dependencies {
34+
implementation project(":dropwizard-jooq")
35+
36+
implementation libs.dropwizardCore
37+
implementation libs.dropwizardDb
38+
implementation dependencies.create("io.dropwizard.modules:dropwizard-flyway:0.9.2-3") {
39+
exclude module: "dropwizard-db"
40+
}
41+
implementation "com.google.auto.value:auto-value-annotations:1.6.2"
42+
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
43+
44+
implementation "org.postgresql:postgresql:42.2.4"
45+
46+
jooqRuntime "org.postgresql:postgresql:42.2.4"
47+
}
48+
49+
jooq {
50+
version = jooqVersion
51+
example(sourceSets.main) {
52+
jdbc {
53+
driver = "org.postgresql.Driver"
54+
url = "jdbc:postgresql://localhost:5432/example_app"
55+
user = "example_user"
56+
password = "s3cr3t"
57+
}
58+
59+
generator {
60+
database {
61+
name = "org.jooq.meta.postgres.PostgresDatabase"
62+
inputSchema = "ex"
63+
}
64+
65+
target {
66+
packageName = "com.bendb.example.db"
67+
}
68+
}
69+
}
70+
}
71+

droptools-example/config/dev.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ databaseMaster:
2828
driverClass: org.postgresql.Driver
2929
user: example_user
3030
password: s3cr3t
31-
url: jdbc:postgresql://localhost:5432/example_app1
31+
url: jdbc:postgresql://localhost:5432/example_app
3232

33+
# In this example the follower connects to the same DB as the
34+
# leader, but this could just as simply be a replica
3335
databaseSlave:
3436
driverClass: org.postgresql.Driver
3537
user: example_user
3638
password: s3cr3t
37-
url: jdbc:postgresql://localhost:5432/example_app2
39+
url: jdbc:postgresql://localhost:5432/example_app
3840

3941
flyway:
4042
# The default prefix is 'V', but I prefer no prefix at all.
@@ -54,4 +56,4 @@ jooq:
5456
executeLogging: no
5557
executeWithOptimisticLocking: no
5658
attachRecords: yes
57-
updatablePrimaryKeys: no
59+
updatablePrimaryKeys: no

0 commit comments

Comments
 (0)