-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbuild.gradle
More file actions
145 lines (127 loc) · 5.66 KB
/
build.gradle
File metadata and controls
145 lines (127 loc) · 5.66 KB
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
import org.labkey.gradle.util.BuildUtils
import org.labkey.gradle.util.PomFileHelper
import org.labkey.gradle.util.GroupNames
import org.labkey.gradle.task.CheckForVersionConflicts
import org.labkey.gradle.plugin.extension.ServerDeployExtension
plugins {
id "java"
id "maven-publish"
id "org.springframework.boot" version "${springBootVersion}"
id "io.spring.dependency-management" version "1.0.8.RELEASE"
}
// 'dependency-management' plugin doesn't allow us to use 'resolutionStrategy.force' to lock versions
ext['log4j2.version'] = log4j2Version
sourceSets {
main {
java {
srcDirs = ['src']
}
}
}
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
embedded
}
configurations.configureEach {
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
}
dependencies {
// Needed to support composite Log4j2 plugins using JSONLayout elements
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}"
implementation("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-json" // Not used (?) and pulls in an old version of Jackson
exclude group: "jakarta.annotation", module: "jakarta.annotation-api" // Already present in tomcat-annotations-api
exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-core" // We want to force apacheTomcatVersion
}
// Allows forcing a Spring Framework version that differs from spring-boot's version (e.g., to address CVEs)
implementation('org.springframework:spring-web') {
version {
strictly "${springVersion}"
}
}
// Allows forcing a Tomcat version that differs from spring-boot's version (e.g., to address CVEs or regressions,
// or to test a Tomcat release candidate)
implementation('org.apache.tomcat.embed:tomcat-embed-core') {
version {
strictly "${apacheTomcatVersion}"
}
}
implementation('org.apache.tomcat.embed:tomcat-embed-el') {
version {
strictly "${apacheTomcatVersion}"
}
}
implementation('org.apache.tomcat.embed:tomcat-embed-websocket') {
version {
strictly "${apacheTomcatVersion}"
}
exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-core" // We want to force apacheTomcatVersion
}
implementation('org.apache.tomcat:tomcat-annotations-api') {
version {
strictly "${apacheTomcatVersion}"
}
}
runtimeOnly "org.apache.tomcat.embed:tomcat-embed-jasper:${apacheTomcatVersion}"
runtimeOnly("org.apache.tomcat:tomcat-dbcp:${apacheTomcatVersion}") {
exclude group: "org.apache.tomcat", module: "tomcat-juli"
}
implementation ("org.apache.logging.log4j:log4j-slf4j2-impl:${log4j2Version}") {
exclude group: 'commons-logging', module: 'commons-logging'
}
implementation "commons-io:commons-io:${commonsIoVersion}"
implementation "org.apache.logging.log4j:log4j-core:${log4j2Version}"
developmentOnly("org.springframework.boot:spring-boot-devtools")
}
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: BuildUtils.getBootstrapProjectPath(gradle))
project.tasks.register(
"checkVersionConflicts", CheckForVersionConflicts)
{ CheckForVersionConflicts task ->
task.group = GroupNames.BUILD
task.description = "Check for conflicts in version numbers of jar file and files already in the build directory ${ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)}. " +
"Default action on detecting a conflict is to fail. Use -PversionConflictAction=[delete|fail|warn] to change this behavior. The value 'delete' will cause the " +
"conflicting version(s) in the ${ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project)} directory to be removed."
task.directory = new File(ServerDeployExtension.getEmbeddedServerDeployDirectoryPath(project))
task.extension = "jar"
task.cleanTask = "server:cleanEmbeddedDeploy"
task.collection = project.tasks.bootJar.outputs.files
}
project.publishing {
publications {
embeddedJar(MavenPublication) {
groupId = 'org.labkey.build'
artifactId = 'embedded'
version = project.version
artifact project.tasks.bootJar.outputs.files.singleFile
pom {
name = "LabKey Server Embedded"
description = "LabKey classes for producing distributions with embedded TomCat."
developers PomFileHelper.getLabKeyTeamDevelopers()
licenses PomFileHelper.getApacheLicense()
organization PomFileHelper.getLabKeyOrganization()
scm PomFileHelper.getLabKeyGitScm()
}
}
if (BuildUtils.shouldPublish(project))
{
project.artifactoryPublish {
publications('embeddedJar')
}
project.artifactoryPublish.skip = false
}
}
}
project.artifacts {
embedded project.tasks.bootJar
}
// The primary artifact from this build should be the jar produced from the bootJar task as that contains
// the SpringBoot classes. This default jar task produces a jar file containing only the classes from src,
// which no one really needs. If produced, this is the jar file that will be used in distributions, making
// them not really embedding anything.
jar {
onlyIf { false }
}