Skip to content

Instantly share code, notes, and snippets.

@melix
Created March 27, 2020 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melix/dc24036f6c94d22e78326bd7605fde6d to your computer and use it in GitHub Desktop.
Save melix/dc24036f6c94d22e78326bd7605fde6d to your computer and use it in GitHub Desktop.
New error message
Unable to find a matching variant of project :platform:
- Variant 'apiElements' capability org.test:platform:1.9:
- Incompatible attribute:
- Required org.gradle.category 'library' and found incompatible value 'platform'.
- Other attributes:
- Required org.gradle.dependency.bundling 'external' but no value provided.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'classes' but no value provided.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Variant 'enforcedApiElements' capability org.test:platform-derived-enforced-platform:1.9:
- Incompatible attribute:
- Required org.gradle.category 'library' and found incompatible value 'enforced-platform'.
- Other attributes:
- Required org.gradle.dependency.bundling 'external' but no value provided.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'classes' but no value provided.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Variant 'enforcedRuntimeElements' capability org.test:platform-derived-enforced-platform:1.9:
- Incompatible attribute:
- Required org.gradle.category 'library' and found incompatible value 'enforced-platform'.
- Other attributes:
- Required org.gradle.dependency.bundling 'external' but no value provided.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'classes' but no value provided.
- Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
- Variant 'runtimeElements' capability org.test:platform:1.9:
- Incompatible attribute:
- Required org.gradle.category 'library' and found incompatible value 'platform'.
- Other attributes:
- Required org.gradle.dependency.bundling 'external' but no value provided.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'classes' but no value provided.
- Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally but no matching variant of project :platform was found.
- Variant 'apiElements' capability org.test:platform:1.9:
- Incompatible attribute:
- Required a library but found a platform
- Other attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Provides an API
- Variant 'enforcedApiElements' capability org.test:platform-derived-enforced-platform:1.9:
- Incompatible attribute:
- Required a library but found an enforced platform
- Other attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Provides an API
- Variant 'enforcedRuntimeElements' capability org.test:platform-derived-enforced-platform:1.9:
- Incompatible attribute:
- Required a library but found an enforced platform
- Other attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Required an API but found a runtime
- Variant 'runtimeElements' capability org.test:platform:1.9:
- Incompatible attribute:
- Required a library but found a platform
- Other attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Required an API but found a runtime
@vlsi
Copy link

vlsi commented Mar 27, 2020

@melix, do you think the common part can be factored out?

For instance:

  • Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
  • Doesn't say anything about its target Java version (required compatibility with Java 8)
  • Doesn't say anything about its elements (required them preferably in the form of class files)

The attributes are common for all the items. Is it worth the repetition?

For instance:

The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally but no matching variant of project :platform was found.
  - Variant 'apiElements' capability org.test:platform:1.9:
      - Incompatible attribute:
          - Required a library but found a platform
      - Other attributes:
          - Provides an API
  - Variant 'enforcedApiElements' capability org.test:platform-derived-enforced-platform:1.9:
      - Incompatible attribute:
          - Required a library but found an enforced platform
      - Other attributes:
          - Provides an API
  - Variant 'enforcedRuntimeElements' capability org.test:platform-derived-enforced-platform:1.9:
      - Incompatible attribute:
          - Required a library but found an enforced platform
      - Other attributes:
          - Required an API but found a runtime
  - Variant 'runtimeElements' capability org.test:platform:1.9:
      - Incompatible attribute:
          - Required a library but found a platform
      - Other attributes:
          - Required an API but found a runtime

Common attributes for all the variants:
      - Other attributes:
          - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
          - Doesn't say anything about its target Java version (required compatibility with Java 8)
          - Doesn't say anything about its elements (required them preferably in the form of class files)

@melix
Copy link
Author

melix commented Mar 27, 2020

It's a good idea, more refactoring for me :)

@vlsi
Copy link

vlsi commented Mar 27, 2020

Required an API but found a runtime

Is it compatible or not? I read it as incompatible, however, it sits in other attributes group for some reason.

By the way, is there color coding in Required a library but found an enforced platform?
For instance:

Required a library but found an enforced platform

@melix
Copy link
Author

melix commented Mar 27, 2020

Thanks I'm indeed adding the compatibility aspect too. It's hard to be terse and give the right amount of info at the same time. Regarding colors, no, there's no option for the moment (it's an exception string, basically).

@autonomousapps
Copy link

Since you can't use colors, maybe backticks or asterisks (pseudo markdown?). Btw, this does look so much friendlier!

@vlsi
Copy link

vlsi commented Mar 29, 2020

I would really like to have colors (e.g. bold vs regular).
It makes a huge difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment