-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
170 lines (143 loc) · 4.79 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'org.springframework.boot' version '3.3.5'
id 'io.spring.dependency-management' version '1.1.6'
id("checkstyle")
}
group = 'com.styra'
version = '0.0.9'
java {
sourceCompatibility = '17'
targetCompatibility = '17'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
tasks.named("bootJar") {
archiveClassifier = 'boot'
}
tasks.named("jar") {
archiveClassifier = ''
}
repositories {
mavenCentral()
}
javadoc {
options.links += [
"https://styrainc.github.io/opa-java/javadoc/",
"https://docs.spring.io/spring-security/site/docs/current/api/",
]
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.security:spring-security-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.security:spring-security-core'
implementation 'org.springframework:spring-context'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.junit.jupiter:junit-jupiter-api:+'
testImplementation 'org.testcontainers:testcontainers-bom:+'
testImplementation 'org.testcontainers:testcontainers:+'
testImplementation 'org.testcontainers:junit-jupiter:+'
testImplementation 'org.mockito:mockito-core:+'
testImplementation 'org.mockito:mockito-junit-jupiter:+'
api group: 'com.styra', name: 'opa', version: '1.8.0'
compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.2'
implementation 'org.slf4j:slf4j-api:2.0.13'
}
apply plugin: 'application'
mainClassName = 'com.styra.opa.springboot'
tasks.named('test') {
useJUnitPlatform()
}
// https://discuss.gradle.org/t/how-to-exclude-checkstyle-task-from-build-task/6692/5
//
// This prevents Checkstyle from running on ./gradlew build, but keeps it
// working for ./gradlew lint.
checkstyle {
sourceSets = []
}
tasks.withType(Checkstyle) {
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
}
task lint {
dependsOn checkstyleTest
dependsOn checkstyleMain
// Note that Gradle linting is disabled because it reports problems that
// simply cannot be fixed. For example, it insists that lombok is unused
// when it is. It claims tomcat duplicates classes from jakarta, which may
// be so but that's getting pulled in by Spring, so we can't control that.
}
test {
useJUnitPlatform()
testLogging {
// uncomment for more verbose output during development
//events "passed", "skipped", "failed", "standard_out", "standard_error"
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
}
}
publishing {
repositories {
maven {
name = "OSSRH"
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
publications {
maven(MavenPublication) {
groupId = 'com.styra.opa'
artifactId = 'springboot'
version = version
from components.java
pom {
name = 'OPA Spring Boot SDK'
description = 'The Styra-supported driver to connect Spring Boot applications to Open Policy Agent (OPA) and Enterprise OPA deployments'
url = 'https://github.com/styrainc/opa-springboot'
scm {
url = 'github.com/styrainc/opa-springboot'
connection = 'scm:git:ssh://[email protected]/styrainc/opa-springboot.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Styra'
organization = 'Styra'
email = '[email protected]'
}
}
organization {
name = 'Styra'
url = 'www.styra.com'
}
}
}
}
}
if (!project.hasProperty('skip.signing')) {
signing {
def signingKey = findProperty("signingKey")
def signingPassphrase = findProperty("signingPassphrase")
useInMemoryPgpKeys(signingKey, signingPassphrase)
sign publishing.publications.maven
}
}