Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teku Maven artifacts issues when including as dependency #7444

Closed
Nashatyrev opened this issue Aug 23, 2023 · 6 comments · Fixed by #7468
Closed

Teku Maven artifacts issues when including as dependency #7444

Nashatyrev opened this issue Aug 23, 2023 · 6 comments · Fixed by #7468
Assignees
Labels
bug 🐞 Something isn't working

Comments

@Nashatyrev
Copy link
Contributor

Nashatyrev commented Aug 23, 2023

Description

When using different versions of io.spring.dependency-management gradle plugin including any Teku module artifact as a maven dependency to a gradle build the following error may occur:

  • version 1.1.0: no errors
  • version 1.1.1: build fails with the following error (plugin issue here)
> Task :startScripts FAILED
2 actionable tasks: 1 executed, 1 up-to-date
Errors occurred while build effective model from C:\Users\Admin\.gradle\caches\modules-2\files-2.1\tech.pegasys.teku.internal\unsigned\23.8.0\c0e66a134880efb10f2882a13b6cfd8d69b2fe7f\unsigned-23.8.0.pom:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':startScripts'.
> Error while evaluating property 'relativeClasspath' of task ':startScripts'
   > Cannot invoke "io.spring.gradle.dependencymanagement.org.apache.maven.model.Model.getGroupId()" because "effectiveModel" is null
  • version 1.1.3: build succeeds bu the the following error(s) are printed:
Errors occurred while building effective model from C:\Users\Admin\.gradle\caches\modules-2\files-2.1\tech.pegasys.teku.internal\unsigned\23.8.0\c0e66a134880efb10f2882a13b6cfd8d69b2fe7f\unsigned-23.8.0.pom:
	'dependencies.dependency[tech.pegasys.teku.internal:unsigned:23.8.0]' for tech.pegasys.teku.internal:unsigned:23.8.0 is referencing itself. in tech.pegasys.teku.internal:unsigned:23.8.0

The above errors indicate another problem: all dependencies of test-fixture scope are also picked up when only module runtime dependencies are required. Here is some more insights: https://stackoverflow.com/questions/69877418/why-does-every-pom-file-published-by-gradle-has-a-self-referential-dependency

Steps to Reproduce (Bug)

run gradle build for the following build.gradle

plugins {
    id 'io.spring.dependency-management' version '1.1.1'
    id "java"
    id "application"
}

repositories {
        mavenCentral()
        maven { url "https://artifacts.consensys.net/public/teku/maven/" }
}

dependencies {
    implementation 'tech.pegasys.teku.internal:unsigned:23.8.0'
}

Expected behavior:

Successful build
Only required artifacts are imported

Actual behavior:

Build fails with the errors described above (depending on the plugin version)

Frequency: Always

Versions (Add all that apply)

  • Software version: 23.8.0
  • Java version: 17
  • OS Name & Version: Windows

Related issues:

Libp2p PR: libp2p/jvm-libp2p#306

@Nashatyrev
Copy link
Contributor Author

CC @StefanBratanov

@rolfyone rolfyone added the bug 🐞 Something isn't working label Aug 23, 2023
@courtneyeh courtneyeh self-assigned this Aug 27, 2023
@tbenr
Copy link
Contributor

tbenr commented Aug 28, 2023

The fix should be something like c91265d

I tested it against a local maven repo and I now get:

Execution failed for task ':startScripts'.
> Error while evaluating property 'relativeClasspath' of task ':startScripts'.
   > Could not resolve all files for configuration ':runtimeClasspath'.
      > Could not find com.google.code.findbugs:jsr305:.
        Required by:
            project : > tech.pegasys.teku.internal:unsigned:develop > com.google.guava:guava:32.1.2-jre
      > Could not find org.checkerframework:checker-qual:.
        Required by:
            project : > tech.pegasys.teku.internal:unsigned:develop > com.google.guava:guava:32.1.2-jre
      > Could not find com.google.errorprone:error_prone_annotations:.
        Required by:
            project : > tech.pegasys.teku.internal:unsigned:develop > com.google.guava:guava:32.1.2-jre

@Nashatyrev might be good enough?

@tbenr
Copy link
Contributor

tbenr commented Aug 28, 2023

sorry @courtneyeh I was curious about this and I ended up spending a bit on it so I wanted to share what I did.

on my local teku i run

./gradlew publishToMavenLocal

and on a test project i used:

plugins {
    id 'io.spring.dependency-management' version '1.1.1'
    id 'java'
    id "application"
}

group = 'org.example'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    testImplementation platform('org.junit:junit-bom:5.9.1')
    testImplementation 'org.junit.jupiter:junit-jupiter'

    implementation 'tech.pegasys.teku.internal:unsigned:develop'
}

test {
    useJUnitPlatform()
}

@tbenr
Copy link
Contributor

tbenr commented Aug 28, 2023

using version 1.1.3 it builds

@courtneyeh
Copy link
Contributor

Thanks @tbenr is this okay to close now?

@tbenr
Copy link
Contributor

tbenr commented Aug 29, 2023

@courtneyeh I did additional checks and seems to work, at least locally.
Opened a PR: #7468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants