-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
113 lines (97 loc) · 3.56 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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java'
id 'maven'
id 'nebula.provided-base' version '3.1.0'
id 'com.github.hierynomus.license' version '0.14.0'
}
group 'net.netzgut.integral'
version '0.0.2-SNAPSHOT'
description 'Integrate Tapestry IOC into Spark'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
project.ext.inceptionYear = '2017'
project.ext.github = 'integral-spark'
repositories {
mavenCentral()
jcenter()
mavenLocal()
}
project.ext.versions = [
// compile
slf4j: '1.7.22',
tapestry: '5.4.2',
fastClasspathScanner: '2.0.21',
// provided
spark: '2.6.0'
]
dependencies {
compile "org.slf4j:slf4j-log4j12:${versions.slf4j}"
compile "org.apache.tapestry:tapestry-ioc:${versions.tapestry}"
compile "io.github.lukehutch:fast-classpath-scanner:${versions.fastClasspathScanner}"
provided "com.sparkjava:spark-core:${versions.spark}"
}
task wrapper(type: Wrapper) { gradleVersion = '3.5' }
task pom {
doLast {
pom {
packaging = 'jar'
project {
inceptionYear inceptionYear
name rootProject.name
description project.description
url "https://github.com/netzgut/$github"
properties { 'project.build.sourceEncoding' 'UTF-8' }
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url "https://github.com/netzgut/$github"
connection "scm:git:git://github.com/netzgut/${github}.git"
developerConnection "scm:git:[email protected]:netzgut/${github}.git"
}
}
}.withXml { xmlProvider ->
def plugins = xmlProvider.asNode().appendNode('build').appendNode('plugins')
def mavenCompilerPlugin = plugins.appendNode('plugin')
mavenCompilerPlugin.appendNode('artifactId').value = 'maven-compiler-plugin'
mavenCompilerPlugin.appendNode('version').value = '3.1'
def mavenCompilerPluginConfiguration = mavenCompilerPlugin.appendNode('configuration')
mavenCompilerPluginConfiguration.appendNode('source').value = sourceCompatibility
mavenCompilerPluginConfiguration.appendNode('target').value = targetCompatibility
}.writeTo('pom.xml')
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
uploadArchives {
// We need to set the variables if not present
ext.snapshot_repository = project.hasProperty('snapshot-repository') ? project.property('snapshot-repository') : ''
ext.snapshot_repository_username = project.hasProperty('snapshot-repository-username') ? project.property('snapshot-repository-username') : ''
ext.snapshot_repository_password = project.hasProperty('snapshot-repository-password') ? project.property('snapshot-repository-password') : ''
repositories {
mavenDeployer {
snapshotRepository(url: snapshot_repository) {
authentication(userName: snapshot_repository_username, password: snapshot_repository_password)
}
}
}
}
license {
header rootProject.file('src/main/resources/META-INF/LICENSE.txt')
strictCheck true
ext.year = Calendar.getInstance().get(Calendar.YEAR)
}