0

Disclaimer: I am new to gradle, so it's likely I'm missing something simple.

Background: I am splitting a service into two services that will live in the same repo. The second service (tester) uses code from the first service (engine), which I have managed to tell gradle. But I have an issue.

Building the tester fails, giving the following error:

Execution failed for task ':engine:processResources'.
Entry application.properties is a duplicate but no duplicate handling strategy has been set

It seems this is a common issue in gradle that someone has already posted about. Unfortunately, pasting each of the responses in my build file has yielded nothing.

I've also tried the kotlin solutions in this thread with similar results: I keep getting the duplicate strategy not set error.

Surely I'm missing something but I can't for the life of me figure out what.

Tester build.gradle.kts Code

plugins {
    kotlin("jvm") version "1.5.10"
    kotlin("plugin.serialization") version "1.5.30"

    id("net.linguica.maven-settings") version "0.5"
}

group = "my.group"
version = "1.0"

repositories {
    mavenCentral()
    maven(url = "my/url") {
        name = "maven-snapshots"
        authentication {
            create<BasicAuthentication>("basic")
        }
    }
    maven(url = "my/other/url") {
        name = "maven-releases"
        authentication {
            create<BasicAuthentication>("basic")
        }
    }
}

//just trying all the things
rootProject.tasks.named("processResources", Copy::class.java) {
    duplicatesStrategy = DuplicatesStrategy.WARN
}

tasks.withType<ProcessResources>() {
    duplicatesStrategy = DuplicatesStrategy.WARN
}

tasks.withType<Copy>() {
    duplicatesStrategy = DuplicatesStrategy.WARN
}

tasks.withType<Jar>() {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

dependencies {
    implementation(project(":engine"))
}
Keverly
  • 476
  • 1
  • 5
  • 14
  • 1
    The error is reporting the failing task is within the `:engine` subproject (`Execution failed for task ':engine:processResources'`). Have you tried adding the `duplicatesStrategy = DuplicatesStrategy.WARN` in `:engine`'s config? – aSemy Nov 15 '22 at 19:49
  • Hmmm, that's gotten me a new error. Will pursue and update with results – Keverly Nov 15 '22 at 19:57
  • It seems to be causing the tester to lose reference of the engine. Continuing to investigate – Keverly Nov 15 '22 at 23:24

0 Answers0