I want to exclude certain jar files from Spring boot fat executable jar file. I want to exclude following files : prosys-opc-ua-sdk-evaluation-4.10.6-24.jar and following BouncyCastle libraries.
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
runtimeOnly 'org.bouncycastle:bcprov-jdk18on:1.73'
// https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on
runtimeOnly 'org.bouncycastle:bcpkix-jdk18on:1.73'
// https://mvnrepository.com/artifact/org.bouncycastle/bcutil-jdk18on
runtimeOnly 'org.bouncycastle:bcutil-jdk18on:1.73'
My build.gradle file is like this.
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.0'
id 'io.spring.dependency-management' version '1.1.0'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
//springBoot {
// mainClass = "opcuaserver.OpcUaServerApplication"
//}
//
//jar {
// manifest {
// attributes(
// 'Main-Class': 'opcuaserver.OpcUaServerApplication'
// )
// }
//}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-amqp'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-websocket'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.amqp:spring-rabbit-test'
testImplementation 'org.springframework.security:spring-security-test'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore
implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.16'
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore-nio
implementation group: 'org.apache.httpcomponents', name: 'httpcore-nio', version: '4.4.16'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
// https://mvnrepository.com/artifact/org.postgresql/postgresql
implementation group: 'org.postgresql', name: 'postgresql', version: '42.6.0'
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on
runtimeOnly 'org.bouncycastle:bcprov-jdk18on:1.73'
// https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on
runtimeOnly 'org.bouncycastle:bcpkix-jdk18on:1.73'
// https://mvnrepository.com/artifact/org.bouncycastle/bcutil-jdk18on
runtimeOnly 'org.bouncycastle:bcutil-jdk18on:1.73'
implementation files('lib/prosys-opc-ua-sdk-evaluation-4.10.6-24.jar')
// implementation files('lib/bcpkix-jdk18on-173.jar')
// implementation files('lib/bcprov-jdk18on-173.jar')
// implementation files('lib/bcutil-jdk18on-173.jar')
// implementation files('lib/slf4j-api-1.7.36.jar')
implementation files('lib/Utils-2.0.0.1.jar')
implementation files('lib/iiot-wizards-common-2.0.0.1.jar')
implementation files('lib/connection-manager-2.0.0.1.jar')
implementation files('lib/iiot-wizards-log-manager-2.0.0.1.jar')
implementation files('lib/LogManager-2.0.0.1.jar')
implementation files('lib/TinyLog-2.0.0.1.jar')
implementation files('lib/iiot-wizards-licensing-2.0.0.1.jar')
implementation files('lib/jniwrap-3.12.jar')
implementation files('lib/iiot-wizards-messaging-2.0.0.1.jar')
implementation files('lib/iiot-wizards-communication-2.0.0.1.jar')
implementation files('lib/GoogleProtocolBuffer_2.6.1.jar')
implementation files('lib/iiot-wizards-history-data-provider-2.0.0.1.jar')
implementation files('lib/emdb-entities-2.0.0.1.jar')
implementation files('lib/emdb-model-2.0.0.1.jar')
implementation files('lib/iiot-wizards-local-data-cache-manager-2.0.0.1.jar')
implementation files('lib/iiot-wizards-history-data-writers-2.0.0.1.jar')
implementation files('lib/iiot-wizards-history-data-provider-2.0.0.1.jar')
implementation files('lib/iiot-wizards-history-entities-2.0.0.1.jar')
}
tasks.named('test') {
useJUnitPlatform()
}