testcontainers / testcontainers/testcontainers-java

[Bug]: shading causes Gradle failure as jar and test tasks are not properly wired

Aperta
#10,353 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

type/bug
Lingua principale
Java
Stelle
8.7k
Fork
1.9k
Merge medio
2g 17h
PR unite (30g)
9

Descrizione

Module

Core

Testcontainers version

1.21.1

Using the latest Testcontainers version?

Yes

Host OS

all

Host Arch

all

Docker version
n/a
What happened?

The following part of the build script causes the failure: https://github.com/testcontainers/testcontainers-java/blob/63189c8678f81c8ef4c431e4468ee74640682654/gradle/shading.gradle#L59-L63

The shading configuration should be adjusted or removed (e.g. https://github.com/testcontainers/testcontainers-java/issues/8612)

$ ./gradlew :docs:examples:junit4:generic:jar :docs:examples:junit4:generic:test

Configuration on demand is an incubating feature.
> Task :docs:examples:junit4:generic:test FAILED

[Incubating] Problems report is available at: file:///Users/kevincooney/git/testcontainers-java/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':docs:examples:junit4:generic:test' (type 'Test').
  - Gradle detected a problem with the following location: '/Users/kevincooney/git/testcontainers-java/docs/examples/junit4/generic/build/libs/generic.jar'.
    
    Reason: Task ':docs:examples:junit4:generic:test' uses this output of task ':docs:examples:junit4:generic:jar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':docs:examples:junit4:generic:jar' as an input of ':docs:examples:junit4:generic:test'.
      2. Declare an explicit dependency on ':docs:examples:junit4:generic:jar' from ':docs:examples:junit4:generic:test' using Task#dependsOn.
      3. Declare an explicit dependency on ':docs:examples:junit4:generic:jar' from ':docs:examples:junit4:generic:test' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.13/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
Relevant log output

Additional Information

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalle righe 59-63 di gradle/shading.gradle e riproduci il fallimento con ./gradlew :docs:examples:junit4:generic:jar :docs:examples:junit4:generic:test. Analizza come la configurazione di shading collega i task jar e test. Il lavoro è completato quando il comando termina senza l’errore di Gradle relativo a una dipendenza implicita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
build-system
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.