eclipse-tractusx / tractusx-edc

Apache License 2.0
37 stars 52 forks source link

contract-spi version mismatch #907

Closed maciej-kizlich closed 9 months ago

maciej-kizlich commented 9 months ago

Describe the bug

EDC version 0.5.3 uses contract-spi in version 0.2.1, which makes contract negotiations fail with:

java.lang.NoSuchMethodError: 'org.eclipse.edc.spi.result.StoreResult org.eclipse.edc.connector.contract.spi.negotiation.store.ContractNegotiationStore.findByCorrelationIdAndLease(java.lang.String)'

since this method was introduced in contract-spi 0.3.0

To Reproduce

Try to negotiate a contract

Expected behavior

Contract should be negotiated

Screenshots/Error Messages

java.lang.NoSuchMethodError: 'org.eclipse.edc.spi.result.StoreResult org.eclipse.edc.connector.contract.spi.negotiation.store.ContractNegotiationStore.findByCorrelationIdAndLease(java.lang.String)'

Context Information

Possible Implementation

florianrusch-zf commented 9 months ago

As @wolf4ood asked in the matrix chat, this is how our build.gradle.kts looks like:

plugins {
    id("application")
    id("com.github.johnrengelman.shadow") version "7.1.2"
}

dependencies {
    implementation("org.eclipse.tractusx.edc:edc-controlplane-postgresql-hashicorp-vault:0.5.3") {
        exclude(group = "org.eclipse.edc", module = "vault-hashicorp")
    }

    implementation(project(":zf-edc-hashicorp-vault"))
}

application {
    mainClass.set("org.eclipse.edc.boot.system.runtime.BaseRuntime")
}

tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
    mergeServiceFiles()
    archiveFileName.set("zf-edc-controlplane.jar")
}

description = "zf-edc-controlplane"

Dataplane looks basically the same. The only thing we changed is that we replace the hashicorp vault extension with our own. We copied the official hashicorp vault extension and switched just the auth method the kubernetes auth method. The build.gradle.kts for our vault extensions looks like this:

plugins {
    id("io.freefair.lombok") version "6.6.1"
}

dependencies {
    implementation("org.eclipse.edc:core-spi:0.3.1")

    implementation("org.bouncycastle:bcpkix-jdk18on:1.76")
    implementation("com.squareup.okhttp3:okhttp:4.12.0")

    testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
    testImplementation("org.mockito:mockito-core:5.2.0")
    testImplementation("org.mockito:mockito-inline:5.2.0")
    testImplementation("org.testcontainers:junit-jupiter:1.19.1")
    testImplementation("org.testcontainers:vault:1.19.1")
    testImplementation("org.eclipse.edc:junit:0.3.1")
}

tasks.withType<Test> {
    useJUnitPlatform()
}

description = "zf-edc-hashicorp-vault"

😅 Annnndddd the root build.gradle.kts of the project is the following:

plugins {
    `java-library`
}

val javaVersion: String by project

allprojects {
    apply(plugin = "java")

    java {
        toolchain {
            languageVersion.set(JavaLanguageVersion.of(javaVersion))
        }

        tasks.withType(JavaCompile::class.java) {
            // making sure the code does not use any APIs from a more recent version.
            // Ref: https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation
            options.release.set(javaVersion.toInt())
        }
        withJavadocJar()
        withSourcesJar()
    }

    repositories {
        mavenLocal()
        mavenCentral()
        maven {
            url = uri("https://maven.iais.fraunhofer.de/artifactory/eis-ids-public/")
        }
        maven {
            url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
        }
    }
}
wolf4ood commented 9 months ago

Hi @florianrusch-zf

tractusx edc 0.5.3 depends on edc upstream 0.2.1, so i think if you pull core-spi:0.3.1, that might cause the issue.

Could you try to change it to and check if the issue persists?

implementation("org.eclipse.edc:core-spi:0.2.1")
florianrusch-zf commented 9 months ago

Goooood catch! Don't know, why we choose 0.3.1 🤔 Will give it try today

florianrusch-zf commented 9 months ago

Yes, that was the problem. @wolf4ood thanks again for the hint!