-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
158 lines (133 loc) · 5.32 KB
/
build.gradle
File metadata and controls
158 lines (133 loc) · 5.32 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
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.3.3/userguide/building_java_projects.html
*/
plugins {
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
// the signing plugin helps us to crypto-sign on our package (PGP key)
id 'signing'
// the git-version plugin helps us to publish an auto version (taken from git tags)
id 'com.palantir.git-version' version '0.13.0'
// Maven Central Portal publishing (community plugin, recommended by Sonatype)
// See: https://vanniktech.github.io/gradle-maven-publish-plugin/central/
id 'com.vanniktech.maven.publish' version '0.28.0'
// translate json schemas to java classes
// id "org.jsonschema2pojo" version "1.1.3"
}
// It is important to set the group and the version to the root project
// so the maven-publish plugin can detect if it is a snapshot version
// or not in order to select the correct repository where artifacts will
// be published
group = 'io.permit'
// sets the java package version automatically (looks at the git repo, latest tags, commit hashes, etc)
version gitVersion()
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
// Note: sources and javadoc JARs are created by the vanniktech maven-publish plugin
}
// package dependencies
dependencies {
// swagger
implementation 'io.swagger:swagger-annotations:1.6.5'
// http client
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
// json serialization and deserialization
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'io.gsonfire:gson-fire:1.8.5'
// openapi annotations
implementation 'javax.ws.rs:jsr311-api:1.1.1'
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
implementation 'org.openapitools:jackson-databind-nullable:0.2.3'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation "jakarta.annotation:jakarta.annotation-api:1.3.5"
// logger
implementation 'ch.qos.logback:logback-classic:1.4.14'
implementation 'ch.qos.logback:logback-core:1.4.14'
implementation 'org.slf4j:slf4j-api:1.7.33'
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
// These dependencies are used internally, and not exposed to consumers on their own compile classpath.
// google standard java library
implementation 'com.google.guava:guava:32.0.0-jre'
}
// Maven Central Portal publishing configuration
// See: https://vanniktech.github.io/gradle-maven-publish-plugin/central/
mavenPublishing {
// Publish to Maven Central Portal
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
// Sign all publications with GPG (required for Maven Central)
// For local testing without GPG, use: ./gradlew publishToMavenLocal -PskipSigning
if (!project.hasProperty('skipSigning')) {
signAllPublications()
}
// Artifact coordinates
coordinates("io.permit", "permit-sdk-java", version.toString())
// POM configuration required by Maven Central
pom {
name = "Permit.io Java SDK"
description = "Java SDK for Permit.io: fullstack permissions for cloud native applications"
url = "https://permit.io"
inceptionYear = "2021"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "permit-io"
name = "Permit Team"
email = "support@permit.io"
}
}
scm {
connection = "scm:git:git://github.com/permitio/permit-java.git"
developerConnection = "scm:git:ssh://github.com/permitio/permit-java.git"
url = "https://github.com/permitio/permit-java"
}
}
}
// GitHub Packages publishing (separate from Maven Central)
publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/permitio/permit-java"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
tasks.named('javadoc') {
// Exclude generated OpenAPI models from javadoc generation
exclude 'io/permit/sdk/openapi/models/**'
}
tasks.named('jar') {
manifest {
attributes('Implementation-Title': project.name, 'Implementation-Version': project.version)
}
}
// Fix Gradle 8.x task dependency validation issue with vanniktech plugin
// The plainJavadocJar task must run before generateMetadataFileForMavenPublication
tasks.withType(GenerateModuleMetadata).configureEach {
dependsOn tasks.matching { it.name == 'plainJavadocJar' }
}