gradle-lint-plugin
gradle-lint-plugin copied to clipboard
Add support for version alignment in multi-module projects with java-platform
This example project is a multi-module project which uses the java-platform
plugin to align the versions of the dependencies across the different modules.
Applying the plugin:
// build.gradle
plugins {
id "nebula.lint" version "16.7.0" apply false
}
allprojects {
apply plugin: 'nebula.lint'
gradleLint.rules = ['all-dependency']
}
And executing the generateGradleLintReport
task, yields two errors:
$ ./gradlew generateGradleLintReport
> Task :generateGradleLintReport FAILED
Error from [com.netflix.nebula.lint.rule.GradleLintRule$1] processing source file [null]
> Task :autoLintGradle FAILED
Error from [com.netflix.nebula.lint.rule.GradleLintRule$1] processing source file [null]
== Build Time Summary ==
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 40% :autoLintGradle (0:00.078)
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 60% :generateGradleLintReport (0:00.117)
== BUILD FAILED ==
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateGradleLintReport'.
> Could not resolve all dependencies for configuration ':common:incrementalScalaAnalysisFormain'.
> Could not find org.scala-lang:scala-library:.
Required by:
project :common
> Could not resolve project :dependencies.
Required by:
project :common
> Unable to find a matching variant of project :dependencies:
- Variant 'apiElements' capability java-scala-gradle-project:dependencies:unspecified:
- Incompatible attribute:
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-api'.
- Other attribute:
- Required org.gradle.category 'platform' and found compatible value 'platform'.
- Variant 'enforcedApiElements' capability java-scala-gradle-project:dependencies-derived-enforced-platform:unspecified:
- Incompatible attributes:
- Required org.gradle.category 'platform' and found incompatible value 'enforced-platform'.
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-api'.
- Variant 'enforcedRuntimeElements' capability java-scala-gradle-project:dependencies-derived-enforced-platform:unspecified:
- Incompatible attributes:
- Required org.gradle.category 'platform' and found incompatible value 'enforced-platform'.
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-runtime'.
- Variant 'runtimeElements' capability java-scala-gradle-project:dependencies:unspecified:
- Incompatible attribute:
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-runtime'.
- Other attribute:
- Required org.gradle.category 'platform' and found compatible value 'platform'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':autoLintGradle'.
> Could not resolve all dependencies for configuration ':common:incrementalScalaAnalysisFormain'.
> Could not find org.scala-lang:scala-library:.
Required by:
project :common
> Could not resolve project :dependencies.
Required by:
project :common
> Unable to find a matching variant of project :dependencies:
- Variant 'apiElements' capability java-scala-gradle-project:dependencies:unspecified:
- Incompatible attribute:
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-api'.
- Other attribute:
- Required org.gradle.category 'platform' and found compatible value 'platform'.
- Variant 'enforcedApiElements' capability java-scala-gradle-project:dependencies-derived-enforced-platform:unspecified:
- Incompatible attributes:
- Required org.gradle.category 'platform' and found incompatible value 'enforced-platform'.
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-api'.
- Variant 'enforcedRuntimeElements' capability java-scala-gradle-project:dependencies-derived-enforced-platform:unspecified:
- Incompatible attributes:
- Required org.gradle.category 'platform' and found incompatible value 'enforced-platform'.
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-runtime'.
- Variant 'runtimeElements' capability java-scala-gradle-project:dependencies:unspecified:
- Incompatible attribute:
- Required org.gradle.usage 'incremental-analysis' and found incompatible value 'java-runtime'.
- Other attribute:
- Required org.gradle.category 'platform' and found compatible value 'platform'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
2 actionable tasks: 2 executed
Had the same issue. The workaround here fixed it: https://github.com/gradle/gradle/issues/6854
Can confirm on @perok's hint, that it is an interrelation issue with Gradle 'scala' plugin (gradle/gradle#6854): Find Scala-only M(N)WE here based on Gradle 6.8.3.
./gradlew lintGradle
gives
> Task :lintGradle FAILED
Error from [com.netflix.nebula.lint.rule.GradleLintRule$1] processing source file [null]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lintGradle'.
> Could not resolve all dependencies for configuration ':incrementalScalaAnalysisFormain'.
> Could not resolve org.scala-lang:scala-library:2.13.5.
Required by:
project :
> No matching variant of org.scala-lang:scala-library:2.13.5 was found. The consumer was configured to find a usage of 'incremental-analysis' of a component but:
- Variant 'compile' capability org.scala-lang:scala-library:2.13.5:
- Incompatible because this component declares an API of a component and the consumer needed a usage of 'incremental-analysis' of a component
- Variant 'enforced-platform-compile' capability org.scala-lang:scala-library-derived-enforced-platform:2.13.5:
- Incompatible because this component declares an API of a component and the consumer needed a usage of 'incremental-analysis' of a component
- Variant 'enforced-platform-runtime' capability org.scala-lang:scala-library-derived-enforced-platform:2.13.5:
- Incompatible because this component declares a runtime of a component and the consumer needed a usage of 'incremental-analysis' of a component
- Variant 'platform-compile' capability org.scala-lang:scala-library-derived-platform:2.13.5:
- Incompatible because this component declares an API of a component and the consumer needed a usage of 'incremental-analysis' of a component
- Variant 'platform-runtime' capability org.scala-lang:scala-library-derived-platform:2.13.5:
- Incompatible because this component declares a runtime of a component and the consumer needed a usage of 'incremental-analysis' of a component
- Variant 'runtime' capability org.scala-lang:scala-library:2.13.5:
- Incompatible because this component declares a runtime of a component and the consumer needed a usage of 'incremental-analysis' of a component
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 635ms
2 actionable tasks: 1 executed, 1 up-to-date
Seems, we have to wait until the above mentioned bug is fixed...