Gradle7.3でgradle.buildを行いwarファイルを作成する際に不要なソースを対象外にしたいです。
build.gradleは以下になります。
buildscript { ext { springBootVersion = '2.6.1' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } plugins { id 'org.springframework.boot' version '2.6.1' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'eclipse' id 'java' id 'war' } jar { baseName = 'demo' version = '0.0.1-SNAPSHOT' } war { // plain.warを生成しないように変更 enabled = false // 不要なディレクトリを対象外にする exclude '**/static/app/**' } processResources.destinationDir = compileJava.destinationDir compileJava.dependsOn processResources def aptGeneratePath = 'build/apt_generated' compileJava.options.compilerArgs = ['-s', aptGeneratePath] compileJava.doFirst { file(aptGeneratePath).mkdirs() } sourceCompatibility = 1.8 ext { outputDir = "bin/main" } eclipse.classpath.file { whenMerged { classpath -> classpath.entries.findAll { entry -> if (entry.kind == "output") { entry.path = "${outputDir}" } } } } repositories { mavenCentral() maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'} } configurations { domaGenRuntime } configurations.all { exclude group: 'org.slf4j', module: 'slf4j-log4j12' } sourceSets { main { // output.resourcesDir = file("$buildDir/classes/java/main") 下の方がいい output.resourcesDir = compileJava.destinationDir } } dependencies { 省略 }
exclude '/static/app/'で正しく除外されません。
rootSpec.exclude '/static/app/'も試しましたが、除外されません。
分かる方いましたら教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。