greenrobot / EventBus

Event bus for Android and Java that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
http://greenrobot.org/eventbus/
Apache License 2.0
24.67k stars 4.66k forks source link

Migrating from 3.2 to 3.3.x breaks build #691

Closed ghost closed 2 years ago

ghost commented 2 years ago

Replicate On Linux, build a non-Android application as follows:

  1. Install Gradle 7.3
  2. Install JDK 17
  3. Update PATH environment variable accordingly.
  4. Open terminal
  5. Run:
    git clone https://github.com/DaveJarvis/keenwrite/
    cd keenwrite
    gradle clean jar
    jar -tvf build/libs/keenwrite.jar | grep -i greenrobot | wc -l

    Build is successful, 55 GreenRobot-related classes found.

  6. Edit build.gradle.
  7. Change the EventBus version from 3.2.0 to 3.3.1:
    implementation 'org.greenrobot:eventbus:3.3.1'
  8. Save the file.
  9. Re-run gradle clean jar

Expected A .jar file is built.

Actual

FAILURE: Build failed with an exception.

* Where:
Build file '.../keenwrite/build.gradle' line: 181

* What went wrong:
Could not determine the dependencies of task ':jar'.
> Could not resolve all files for configuration ':runtimeClasspath'.
   > Could not resolve org.greenrobot:eventbus:3.3.1.
     Required by:
         project :
      > No matching variant of org.greenrobot:eventbus:3.3.1 was found. The consumer was configured to find a runtime of a library compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'releaseApiPublication' capability org.greenrobot:eventbus:3.3.1 declares a library, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component, with the library elements 'aar' and the consumer needed a runtime of a component, packaged as a jar
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
          - Variant 'releaseRuntimePublication' capability org.greenrobot:eventbus:3.3.1 declares a runtime of a library, and its dependencies declared externally:
              - Incompatible because this component declares a component, with the library elements 'aar' and the consumer needed a component, packaged as a jar
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 17)
andob commented 2 years ago

please use :eventbus-java: artifact. :eventbus: is android-only.