|
| 1 | +plugins { |
| 2 | + jacoco |
| 3 | + `java-library` |
| 4 | + `maven-publish` |
| 5 | + id ("org.sonarqube") version "3.3" |
| 6 | + id("io.freefair.lombok") version "6.2.0" |
| 7 | +} |
| 8 | + |
| 9 | +group = "com.frog-development" |
| 10 | + |
| 11 | +configure<JavaPluginExtension> { |
| 12 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 13 | + targetCompatibility = JavaVersion.VERSION_11 |
| 14 | +} |
| 15 | + |
| 16 | +repositories { |
| 17 | + mavenCentral() |
| 18 | +} |
| 19 | + |
| 20 | +dependencies { |
| 21 | + |
| 22 | + api("io.jsonwebtoken:jjwt:0.9.1") |
| 23 | + |
| 24 | + implementation("org.springframework.boot:spring-boot-starter-security:2.5.6") |
| 25 | + implementation("org.springframework.boot:spring-boot-actuator-autoconfigure:2.5.6") |
| 26 | + implementation("ch.qos.logback:logback-classic:1.2.6") |
| 27 | + implementation("javax.servlet:javax.servlet-api:4.0.1") |
| 28 | + implementation("javax.xml.bind:jaxb-api:2.3.1") |
| 29 | + |
| 30 | + compileOnly("org.jetbrains:annotations:23.0.0") |
| 31 | + compileOnly("org.springframework.security:spring-security-test:5.5.3") |
| 32 | + |
| 33 | + testImplementation("org.springframework.boot:spring-boot-starter-test:2.5.6") |
| 34 | + testImplementation("org.springframework.security:spring-security-test:5.5.3") |
| 35 | + testImplementation("org.junit.platform:junit-platform-runner:1.8.1") |
| 36 | +} |
| 37 | + |
| 38 | +tasks.named<Test>("test") { |
| 39 | + reports.html.required.set(false) |
| 40 | + |
| 41 | + useJUnitPlatform { |
| 42 | + includeTags("unitTest") |
| 43 | + excludeTags("integrationTest") |
| 44 | + } |
| 45 | + |
| 46 | + finalizedBy(tasks.named("jacocoTestReport")) |
| 47 | +} |
| 48 | + |
| 49 | +tasks.named<JacocoReport>("jacocoTestReport") { |
| 50 | + dependsOn(tasks.named("test")) |
| 51 | + reports { |
| 52 | + xml.required.set(true) |
| 53 | +// xml.destination file("${buildDir}/reports/jacoco/test.xml") |
| 54 | + csv.required.set(false) |
| 55 | + html.required.set(false) |
| 56 | + } |
| 57 | +} |
| 58 | + |
| 59 | +//tasks.named<JacocoCoverageVerification>("jacocoTestCoverageVerification") { |
| 60 | +// violationRules { |
| 61 | +// rule { |
| 62 | +// limit { |
| 63 | +// minimum = "0.9".toBigDecimal() |
| 64 | +// } |
| 65 | +// } |
| 66 | +// } |
| 67 | +//} |
| 68 | + |
| 69 | +sonarqube { |
| 70 | + properties { |
| 71 | +// property ("sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/test.xml") |
| 72 | + property ("sonar.projectKey", "FrogDevelopment_authorization-jwt-module") |
| 73 | + property ("sonar.organization", "frogdevelopment") |
| 74 | + property ("sonar.host.url", "https://sonarcloud.io") |
| 75 | + } |
| 76 | +} |
| 77 | + |
| 78 | +project.tasks["sonarqube"].dependsOn("jacocoTestReport") |
| 79 | + |
| 80 | +java { |
| 81 | + withSourcesJar() |
| 82 | +} |
| 83 | + |
| 84 | +publishing { |
| 85 | + publications { |
| 86 | + create<MavenPublication>("mavenJava") { |
| 87 | + from(components["java"]) |
| 88 | + |
| 89 | + pom { |
| 90 | + name.set("Authorisation JWT") |
| 91 | + description.set("Handle Spring Security with JWT") |
| 92 | + licenses { |
| 93 | + license { |
| 94 | + name.set("The Apache License, Version 2.0") |
| 95 | + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") |
| 96 | + } |
| 97 | + } |
| 98 | + developers { |
| 99 | + developer { |
| 100 | + id.set("legall.benoit") |
| 101 | + name.set("Benoît Le Gall") |
| 102 | + email.set("legall.benoit@gmail.com") |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +tasks.wrapper { |
| 111 | + gradleVersion = "7.2" |
| 112 | + distributionType = Wrapper.DistributionType.ALL |
| 113 | +} |
0 commit comments