forked from beranradek/formio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
145 lines (122 loc) · 4.52 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// See authoritative guide for publishing to public Maven central repo
// with Gradle: http://central.sonatype.org/pages/gradle.html
// and also http://jedicoder.blogspot.cz/2011/11/automated-gradle-project-deployment-to.html
// Plugins
buildscript {
repositories { jcenter() }
dependencies {
// for introducing optional and provided configurations for dependencies
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.+'
}
}
// Other plugins using plugins DSL
// release plugin adding release task, see: https://github.com/researchgate/gradle-release
plugins {
id 'net.researchgate.release' version '2.1.2'
}
apply plugin: 'java'
apply plugin: 'optional-base' // gradle-extra-configurations-plugin allowing use of optional configuration for dependencies
apply plugin: 'maven' // takes care of the metadata, generates the pom.xml when publishing to repo, deploys build output to repo
apply plugin: 'signing' // signs generated artifacts: https://docs.gradle.org/current/userguide/signing_plugin.html
apply plugin: 'eclipse'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
mavenCentral()
}
dependencies {
// Required compile-time dependencies
compile "javax.validation:validation-api:1.1.0.Final"
compile "commons-fileupload:commons-fileupload:1.3.1"
// Optional dependencies
compile "javax.servlet:servlet-api:2.5", optional
compile "javax.portlet:portlet-api:2.0", optional
// Test dependencies
testCompile "junit:junit:4.8.2"
testCompile "org.hibernate:hibernate-validator:4.3.1.Final"
testCompile "org.springframework:spring-mock:2.0.8"
testCompile "commons-httpclient:commons-httpclient:3.1"
testCompile "org.springframework:spring-core:3.2.12.RELEASE"
testCompile "org.springframework:spring-portlet:2.0.8"
}
// Task for generating javadoc artifact
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
// Task for generating sources artifact
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
// Gather all output artifacts together
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
// See: http://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/
if (isReleaseVersion) {
signing {
// Conditions under which the signing is executed
required { isReleaseVersion }
sign configurations.archives
}
}
// Deployment to Maven Central repository can be started using: gradle uploadArchives
// The credentials for signing and upload are stored in <user-home>/.gradle/gradle.properties file
// Signing key is stored in <user-home>/AppData/Roaming/gnupg/secring.gpg
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// Sonatype Nexus Staging
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
// Sonatype Nexus Snapshost
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Formio'
packaging 'jar'
// optionally artifactId can be defined here
artifactId 'formio'
description 'Form definition and binding framework for Java platform'
url 'http://www.formio.net'
scm {
connection 'scm:git:[email protected]:beranradek/formio.git'
developerConnection 'scm:git:[email protected]:beranradek/formio.git'
url '[email protected]:beranradek/formio.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'beranradek'
name 'Radek Beran'
email '[email protected]'
}
}
}
}
}
}
// Turning off doclint javadoc style checker that produces strict errors.
// See: http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
// Make sure uploadArchives (uploading artifacts to Maven central) is performed
// after the build with the release version has finished
afterReleaseBuild.dependsOn uploadArchives