-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathbuild.gradle
96 lines (80 loc) · 3.32 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* This build file was generated with the following command, and subsequently edited by hand:
* gradle init --type java-application
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.1/userguide/tutorial_java_projects.html
*/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.jooq:jooq-codegen:3.7.4'
classpath 'com.h2database:h2:1.4.177'
}
}
// Apply the java plugin to add support for Java generally
apply plugin: 'java'
// Apply the application plugin to add support for building and running an application
apply plugin: 'application'
// Define the main class for the application. This is what gets executed when you do `gradle run`
mainClassName = 'SimpleApplication'
// Dropwizard requires two params - whether to run in "server" mode, or in "check configuration" mode
// and a configuration file
run {
args "server", "appconfig.yml"
}
// You should really specify which version of Java we are building for - otherwise
// you'll be subject to defaults in your environment, which can have unexpected values
sourceCompatibility = 1.8
targetCompatibility = 1.8
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies. 99% of the time you won't need anything else
jcenter()
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5'
}
dependencies {
// Compile dependencies will be available on compile classpath of this component and consumers.
compile 'com.google.guava:guava:22.0' // Great java utility library
compile 'io.dropwizard:dropwizard-core:1.2.0-rc2' // Great implementation of many basic Java Server libs
compile 'io.dropwizard:dropwizard-db:1.2.0-rc2' // Provides manages data sources
compile 'org.jooq:jooq:3.9.5' // DSL for SQL in java
compile 'com.h2database:h2:1.4.196' // in-memory SQL. we'll upgrade to mysql later
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile "org.mockito:mockito-core:2.+" // mockito for unit tests
compile 'com.google.cloud:google-cloud-vision:0.24.0-beta' // Google Vision API
}
task generate {
doLast {
def writer = new StringWriter()
new groovy.xml.MarkupBuilder(writer)
.configuration('xmlns': 'http://www.jooq.org/xsd/jooq-codegen-3.7.0.xsd') {
jdbc() {
driver('org.h2.Driver')
url('jdbc:h2:mem:test;MODE=MySQL;INIT=RUNSCRIPT from \'./src/main/resources/schema.sql\'')
user('sa')
password('sa')
}
generator() {
database() {
name('org.jooq.util.h2.H2Database')
inputSchema('public')
}
generate() {}
target() {
packageName('generated')
directory('src/main/java')
}
}
}
org.jooq.util.GenerationTool.generate(
javax.xml.bind.JAXB.unmarshal(new StringReader(writer.toString()), org.jooq.util.jaxb.Configuration.class)
)
}
}