type or paste code here
group 'com.**'
ext['spring-kafka.version'] = '2.9.11'
buildscript {
ext {
springBootVersion = '2.7.18'
lombokVersion = '1.18.24'
appfabricSpringVersion = '4.2.1'
dalVersion = '1.0.49.RELEASE'
libsVersion = '1.0.32.RELEASE'
tomcatVersion = '9.0.90'
tikaVersion = '2.4.0'
sys_user = System.env.SYS_USER
sys_pass = System.env.SYS_PASSWORD
subfolder = System.env.ARTIFACT_SUB_FOLDER
}
repositories {
maven {
url 'Link.1.com'
}
}
plugins {
id "org.sonarqube" version "5.1.0.4882"
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:5.1.0.4882')
classpath('org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0')
classpath('org.openapitools:openapi-generator-gradle-plugin:4.2.3')
}
}
apply plugin: 'java'
apply plugin: 'org.sonarqube'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'org.openapi.generator'
sourceCompatibility = 17
targetCompatibility = 17
version = '1.0.0'
if (System.env.BUILD_NUMBER) {
version = "1.0.${System.env.BUILD_NUMBER}"
}
repositories {
maven {
url "link.2.com"
credentials {
username = (System.env.SYS_USER != null && System.env.SYS_USER != '') ? System.env.SYS_USER : System.env.LOCAL_USER
password = (System.env.SYS_PASSWORD != null && System.env.SYS_PASSWORD != '') ? System.env.SYS_PASSWORD : System.env.LOCAL_PASSWORD
}
}
maven {
url 'Link.3.com'
credentials {
username = (System.env.SYS_USER != null && System.env.SYS_USER != '') ? System.env.SYS_USER : System.env.LOCAL_USER
password = (System.env.SYS_PASSWORD != null && System.env.SYS_PASSWORD != '') ? System.env.SYS_PASSWORD : System.env.LOCAL_PASSWORD
}
}
maven {
url 'Link.4.com'
credentials {
username = (System.env.SYS_USER != null && System.env.SYS_USER != '') ? System.env.SYS_USER : System.env.LOCAL_USER
password = (System.env.SYS_PASSWORD != null && System.env.SYS_PASSWORD != '') ? System.env.SYS_PASSWORD : System.env.LOCAL_PASSWORD
}
}
mavenCentral()
}
tasks.register('zipTestResults', Zip) {
from projectDir
archiveAppendix = 'audit'
archiveBaseName = 'test-results'
destinationDirectory = file("$buildDir/zips")
include 'build/reports/**'
include 'build/test-results/**'
include 'git-commit'
}
test {
//Line below opens the java.util package to all unnamed modules, making the serialVersionUID field accessible.
jvmArgs += '--add-opens=java.base/java.util=ALL-UNNAMED'
testLogging {
events = ['passed', 'failed']
exceptionFormat = 'full'
}
reports {
junitXml.required = true
junitXml.outputLocation = layout.buildDirectory.dir("test-results/junit")
}
outputs.upToDateWhen { false }
}
bootJar {
enabled = true
manifest {
attributes(
'Specification-Version': archiveVersion
)
}
}
jar {
enabled = false
}
sonarqube {
properties {
property 'sonar.projectName','project'
property 'sonar.exclusions', '**/generated/**.java'
property 'sonar.host.url', 'https://sonarqube.allstate.com'
property 'sonar.login', sys_user
property 'sonar.password', sys_pass
property 'sonar.sources', 'src/main'
property 'sonar.projectKey', 'Project'
}
}
jacocoTestReport {
reports {
//xml.enabled true
xml.required = true
}
}
publishing {
publications {
myArtifact(MavenPublication) {
from components.java
artifactId archivesBaseName
artifacts = ["build/libs/**-${version}.jar"]
artifact(zipTestResults) {
classifier 'audit'
}
}
}
}
artifactory {
contextUrl = 'Link.5.com'
publish {
repository {
repoKey = "ISG-UnstructuredData/udp-core/${subfolder}"
username = sys_user
password = System.env.SYS_PASSWORD
}
defaults {
properties = ['git.commit': System.env.GITHUB_COMMIT_ID]
publications('myArtifact')
}
}
clientConfig.info.setBuildNumber(System.env.BUILD_NUMBER)
}
test {
useJUnitPlatform()
}
dependencies {
implementation "com.compozed.appfabric:com-compozed-appfabric-security:${appfabricSpringVersion}"
implementation "com.compozed.appfabric:com-compozed-appfabric-oauth2-starter-api:${appfabricSpringVersion}"
implementation(group: 'com.compozed.appfabric', name: 'com-compozed-appfabric-kafka', version: '4.2.1') {
exclude group: 'org.apache.commons', module: 'commons-compress'
}
implementation "com.allstate.isg:udp-on-prem-cms-lib:1.0.51"
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.cloud:spring-cloud-starter-config:3.0.2'
implementation 'org.springframework.cloud:spring-cloud-starter-vault-config:3.1.3'
implementation 'org.springframework.data:spring-data-mongodb:3.3.5'
implementation "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.261'
implementation "com.allstate.isg:udp-on-prem-common-libs:${libsVersion}"
implementation "com.allstate.isg:udp-on-prem-dal:${dalVersion}"
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'com.microsoft.sqlserver:mssql-jdbc:9.4.1.jre8'
implementation group: "com.github.java-json-tools", name: "json-schema-validator", version: "2.2.14"
// AVRO
implementation 'io.confluent:kafka-avro-serializer:5.5.0'
implementation 'io.confluent:kafka-schema-registry-client:5.5.0'
implementation group: 'org.apache.avro', name: 'avro', version: '1.9.2'
implementation group: 'org.apache.kafka', name: 'kafka-clients', version: '3.2.3'
//Vulnerability fix
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.21'
// implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.67'
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation group: 'org.glassfish.jersey.core', name: 'jersey-common', version: '2.34'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: "${tomcatVersion}"
implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: '5.6.4'
implementation group: 'org.springframework.security', name: 'spring-security-web', version: '5.8.11'
implementation("org.springframework.security:spring-security-core:5.8.11")
implementation "org.yaml:snakeyaml:1.32"
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.4'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.4.2'
implementation "org.springframework:spring-expression:x 6.0.7"
implementation "org.springframework:spring-webmvc:6.0.7"
implementation "org.springframework.vault:spring-vault-core:2.3.3"
implementation group: "com.google.guava", name: "guava", version: "32.0.1-jre"
//CVE-2023-43642
implementation("org.xerial.snappy:snappy-java:1.1.10.4")
implementation "ch.qos.logback:logback-core:1.2.13"
implementation "ch.qos.logback:logback-classic:1.2.13"
// CVE-2023-34042
implementation 'org.springframework.security:spring-security-config:5.7.11'
//CVE-2023-39410
implementation "org.apache.avro:avro:1.11.3"
configurations.implementation {
exclude group: "org.bouncycastle",module: "bcprov-jdk15on"
exclude group: "org.bouncycastle",module: "bcprov-jdk18on"
exclude group : "com.h2database", module:"h2"
exclude group: 'org.apache.commons', module: 'commons-compress'
}
testImplementation "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.github.benas:random-beans:3.4.0'
testImplementation "com.compozed.appfabric:com-compozed-appfabric-starter-api-testutils:${appfabricSpringVersion}"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework') {
details.useVersion '5.3.39'
details.because 'CVE-2022-22950'
}
if (details.requested.group == 'org.springframework' && details.requested.module.name == 'spring-webmvc') {
details.useVersion '5.3.39'
}
if (details.requested.group == 'org.springframework' && details.requested.module.name == 'spring-expression') {
details.useVersion '5.3.39'
}
if (details.requested.group == 'org.springframework' && details.requested.module.name == 'spring-web') {
details.useVersion '5.3.39'
// CVE-2024-22243
}
}
resolutionStrategy.dependencySubstitution {
substitute(module('org.springframework:spring-webmvc:5.3.31'))
.using(module('org.springframework:spring-webmvc:5.3.39'))
.because('CVE-2024-38816')
substitute(module('org.apache.tomcat.embed:tomcat-embed-websocket:9.0.83'))
.using(module('org.apache.tomcat.embed:tomcat-embed-websocket:9.0.90'))
.because('CVE-2024-23672')
substitute(module('com.nimbusds:nimbus-jose-jwt:9.22'))
.using(module('com.nimbusds:nimbus-jose-jwt:9.37.2'))
.because('CVE-2023-52428')
// Fix for CVE-2024-25710
substitute(module('software.amazon.ion:ion-java:1.0.2'))
.using(module('com.amazon.ion:ion-java:1.10.5'))
.because('CVE-2023-52428')
}
}
processTestResources {
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
sourceSets {
main {
java {
srcDir "${rootDir}/generated/bulkaccessapi/src/main/java"
}
}
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.12.261'
}
}
openApiGenerate {
generatorName = "java"
library = "resttemplate"
inputSpec = "$rootDir/src/main/resources/bulk-access-spec.yaml".toString()
outputDir = "${rootDir}/generated/bulkaccessapi".toString()
systemProperties = [
modelDocs: "false",
models : "",
apis : "false",
]
configOptions = [
useOptional : "true",
swaggerDocketConfig : "false",
performBeanValidation: "true",
useBeanValidation : "true",
useTags : "false",
singleContentTypes : "true",
title : rootProject.name,
java17 : "true",
dateLibrary : "java17",
serializableModel : "true",
serializationLibrary : "jackson",
skipDefaultInterface : "true",
artifactId : rootProject.name,
apiPackage : "com.",
modelPackage : "com..model",
invokerPackage : "com.",
interfaceOnly : "true"
]
}
compileJava.dependsOn tasks.openApiGenerate