In my gradle build file, I have the following plugin block
plugins {
`java-library`
jacoco
checkstyle
}
None of these specify a version but everything works.
Assume that a project is using gradle 6.0 with the gradle wrapper but the system has gradle 5.0 installed.
Questions:
./gradlew build
the java plugin from gradle 6.0 will be executed. Is this true or false?gradle build
the java plugin from gradle 5.0 will be executed. Is this true or false?Gradle distinguishes between core and community plugins. Core plugins are built into the Gradle distribution and can be referenced by their unqualified short name ("java" vs. "org.gradle.java"). They're not retrieved from the plugin portal. Core plugins must not include a version constraint (Javadoc Reference). Find the list of core plugins here.
Community plugins are hosted and retrieved from the plugin portal. They must be given in the fully qualified plugin ID along with a version.
Find out more about plugins in these guides:
If I run gradle wrapper
./gradlew build
the java plugin from gradle 6.0 will be executed. Is this true or false?
True, since the Gradle Wrapper ensures the build is run with the specified Gradle version and core plugins are bundled with the distribution.
If I run system gradle
gradle build
the java plugin from gradle 5.0 will be executed. Is this true or false?
True.
Are these plugins bundled into the gradle distribution itself or are they downloaded from the gradle plugin portal on demand?
Bundled, as explained earlier.
Is the build considered to be non-reproducible (like it is in maven) because the plugin versions were not set?
The build can be considered reproducible as long as the same Gradle version is used since the core plugins are bundled with the distribution.
What are the gradle best practices around plugin versions should they be set or left off?
As explained earlier, you don't have a choice here. Core plugins must not define a version whereas community plugins must be along a version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With