I have dev.conf file in src/main/resources folder which is relevant only for running projects locally from IDE. When running gradlew build docker I would like to exclude this dev.conf file from jar. My build.gradle looks like that:
buildscript {
ext {
springBootVersion = '2.7.3'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'com.palantir.docker' version '0.34.0'
id "com.gorylenko.gradle-git-properties" version "2.4.1"
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.11
def versions = [
ScalaBinary: "2.13",
akkaVersion: "2.6.19",
lightbendVersion: "1.1.3",
SlickVersion: "3.3.3"
]
group 'com.vanilla'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
...
}
}
test {
useJUnitPlatform()
}
jar{
manifest {
attributes 'Main-class': 'com.vanilla.Application'
}
}
springBoot {
buildInfo()
}
sourceSets {
main {
resources {
exclude '**/dev.conf'
}
}
}
//docker configuration to follow.
However, after adding exclude closure, my dev.conf excluded in every task including running from intellij. How can I exclude this file only while building jar and creating docker from it.