intellij-platform-gradle-plugin
intellij-platform-gradle-plugin copied to clipboard
Gradle's api & compileOnlyApi configurations created by its java-library plugin do not work, and transitive implementation scope dependencies get exposed, when this plugin is used
What happened?
Gradle's java-library plugin is more suitable for IntelliJ plugin development than regular java. I think it must be supported, since it a basic Gradle feature.
See:
- https://docs.gradle.org/current/userguide/java_plugin.html
- https://docs.gradle.org/current/userguide/java_library_plugin.html
Sub-issue:
- If you look carefully at the output on the screenshot below, you will see that
org.apache.commons:commons-lang3:3.5was exposed as a transitive dependency thoughimplementationdependency scope, which is not supposed to happen. It is bad.
The setup:
build.gradle.kts
plugins {
`java-library`
//id("org.jetbrains.kotlin.jvm") version "2.0.20"
id("org.jetbrains.intellij.platform") version "2.1.0"
}
dependencies {
implementation(project(":subpr"))
}
repositories {
mavenLocal()
mavenCentral()
}
settings.gradle.kts
rootProject.name = "123"
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
}
include(":subpr")
subpr/build.gradle.kts
plugins {
`java-library`
//id("org.jetbrains.kotlin.jvm") version "2.0.20"
id("org.jetbrains.intellij.platform.module")
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compileOnlyApi("org.jetbrains:annotations:26.0.1")
implementation("org.apache.commons:commons-lang3:3.5")
}
Expected result:
org.jetbrains:annotations:26.0.1is available to the root project transitively from the sub project.
Actual result result:
- It is not, while what should not be available (
org.apache.commons:commons-lang3:3.5) is there.
If kotlin plugin is added to the sub-project, somehow it starts working, but implementation is still exposed:
Relevant log output or stack trace
sasha@sasha-kubuntu:~/sources/test-java-lib $ gradle dependencies --configuration compileClasspath
> Task :dependencies
------------------------------------------------------------
Root project '123'
------------------------------------------------------------
compileClasspath - Compile classpath for source set 'main'.
\--- project :subpr
\--- org.apache.commons:commons-lang3:3.5
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 409ms
1 actionable task: 1 executed
sasha@sasha-kubuntu:~/sources/test-java-lib $ gradle :subpr:outgoingVariants --all
> Task :subpr:outgoingVariants
--------------------------------------------------
Variant apiElements
--------------------------------------------------
API elements for the 'main' feature.
Capabilities
- 123:subpr:unspecified (default capability)
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = jar
- org.gradle.usage = java-api
Artifacts
- build/libs/subpr-base.jar (artifactType = jar, classifier = base)
Secondary Variants (*)
--------------------------------------------------
Secondary Variant classes
--------------------------------------------------
Directories containing compiled class files for main.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = classes
- org.gradle.usage = java-api
Artifacts
- build/classes/java/main (artifactType = java-classes-directory)
--------------------------------------------------
Variant archives
--------------------------------------------------
Configuration for archive artifacts.
Capabilities
- 123:subpr:unspecified (default capability)
Artifacts
- build/libs/subpr-base.jar (artifactType = jar, classifier = base)
--------------------------------------------------
Variant default
--------------------------------------------------
Configuration for default artifacts.
Capabilities
- 123:subpr:unspecified (default capability)
Artifacts
- build/libs/subpr-base.jar (artifactType = jar, classifier = base)
--------------------------------------------------
Variant intellijPlatformComposedJar (l)
--------------------------------------------------
IntelliJ Platform final composed Jar archive
Capabilities
- 123:subpr:unspecified (default capability)
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = composed-jar
- org.gradle.usage = java-runtime
- org.jetbrains.kotlin.platform.type = jvm
Artifacts
- build/libs/subpr.jar (artifactType = jar)
--------------------------------------------------
Variant intellijPlatformDistribution
--------------------------------------------------
IntelliJ Platform distribution Zip archive
Capabilities
- 123:subpr:unspecified (default capability)
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = distribution
- org.gradle.usage = java-runtime
- org.jetbrains.kotlin.platform.type = jvm
--------------------------------------------------
Variant mainSourceElements (i)
--------------------------------------------------
List of source directories contained in the Main SourceSet.
Capabilities
- 123:subpr:unspecified (default capability)
Attributes
- org.gradle.category = verification
- org.gradle.dependency.bundling = external
- org.gradle.verificationtype = main-sources
Artifacts
- src/main/java (artifactType = directory)
- src/main/resources (artifactType = directory)
--------------------------------------------------
Variant runtimeElements
--------------------------------------------------
Runtime elements for the 'main' feature.
Capabilities
- 123:subpr:unspecified (default capability)
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = jar
- org.gradle.usage = java-runtime
Artifacts
- build/libs/subpr-base.jar (artifactType = jar, classifier = base)
Secondary Variants (*)
--------------------------------------------------
Secondary Variant classes
--------------------------------------------------
Directories containing compiled class files for main.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = classes
- org.gradle.usage = java-runtime
Artifacts
- build/classes/java/main (artifactType = java-classes-directory)
--------------------------------------------------
Secondary Variant resources
--------------------------------------------------
Directories containing assembled resource files for main.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = resources
- org.gradle.usage = java-runtime
Artifacts
- build/resources/main (artifactType = java-resources-directory)
--------------------------------------------------
Variant testResultsElementsForTest (i)
--------------------------------------------------
Directory containing binary results of running tests for the test Test Suite's test target.
Capabilities
- 123:subpr:unspecified (default capability)
Attributes
- org.gradle.category = verification
- org.gradle.testsuite.name = test
- org.gradle.testsuite.target.name = test
- org.gradle.testsuite.type = unit-test
- org.gradle.verificationtype = test-results
Artifacts
- build/test-results/test/binary (artifactType = directory)
(l) Legacy or deprecated configuration. Those are variants created for backwards compatibility which are both resolvable and consumable.
(i) Configuration uses incubating attributes such as Category.VERIFICATION.
(*) Secondary variants are variants created via the Configuration#getOutgoing(): ConfigurationPublications API which also participate in selection, in addition to the configuration itself.
BUILD SUCCESSFUL in 412ms
1 actionable task: 1 executed
sasha@sasha-kubuntu:~/sources/test-java-lib $ gradle resolvableConfigurations
> Task :resolvableConfigurations
--------------------------------------------------
Configuration annotationProcessor
--------------------------------------------------
Annotation processors and their dependencies for source set 'main'.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.libraryelements = jar
- org.gradle.usage = java-runtime
--------------------------------------------------
Configuration compileClasspath
--------------------------------------------------
Compile classpath for source set 'main'.
Attributes
- intellijPlatformCollected = true
- intellijPlatformExtracted = true
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = composed-jar
- org.gradle.usage = java-api
Extended Configurations
- compileOnly
- implementation
--------------------------------------------------
Configuration intellijPlatformBundledModules
--------------------------------------------------
IntelliJ Platform bundled modules
--------------------------------------------------
Configuration intellijPlatformBundledPlugins
--------------------------------------------------
IntelliJ Platform bundled plugins
--------------------------------------------------
Configuration intellijPlatformDependencies
--------------------------------------------------
IntelliJ Platform extra dependencies
Extended Configurations
- intellijPlatformBundledModules
- intellijPlatformBundledPlugins
- intellijPlatformPlugin
- intellijPlatformPluginModule
--------------------------------------------------
Configuration intellijPlatformDependency
--------------------------------------------------
IntelliJ Platform
Attributes
- intellijPlatformExtracted = true
Extended Configurations
- intellijPlatformDependencyArchive
- intellijPlatformLocal
--------------------------------------------------
Configuration intellijPlatformDependencyArchive
--------------------------------------------------
IntelliJ Platform dependency archive
--------------------------------------------------
Configuration intellijPlatformJavaCompiler
--------------------------------------------------
Java Compiler used by Ant tasks
--------------------------------------------------
Configuration intellijPlatformLocal
--------------------------------------------------
IntelliJ Platform local
Attributes
- intellijPlatformExtracted = true
--------------------------------------------------
Configuration intellijPlatformPlugin
--------------------------------------------------
IntelliJ Platform plugins
Attributes
- intellijPlatformExtracted = true
- intellijPlatformLocalPluginsNormalized = true
- org.gradle.libraryelements = distribution
Extended Configurations
- intellijPlatformPluginDependency
- intellijPlatformPluginLocal
--------------------------------------------------
Configuration intellijPlatformPluginDependency
--------------------------------------------------
IntelliJ Platform plugin dependencies
--------------------------------------------------
Configuration intellijPlatformPluginDependencyCollector
--------------------------------------------------
IntelliJ Platform plugin dependencies internal collector
Extended Configurations
- intellijPlatformPluginDependency
- intellijPlatformPluginLocal
--------------------------------------------------
Configuration intellijPlatformPluginLocal
--------------------------------------------------
IntelliJ Platform plugin local
Attributes
- intellijPlatformExtracted = false
- org.gradle.libraryelements = distribution
--------------------------------------------------
Configuration intellijPlatformPluginModule
--------------------------------------------------
IntelliJ Platform plugin module
Attributes
- org.gradle.libraryelements = composed-jar
--------------------------------------------------
Configuration intellijPlatformRuntimeClasspath
--------------------------------------------------
IntelliJ Platform Runtime Classpath resolvable configuration
Attributes
- org.gradle.libraryelements = composed-jar
Extended Configurations
- runtimeClasspath
--------------------------------------------------
Configuration intellijPlatformTestClasspath
--------------------------------------------------
IntelliJ Platform Test Classpath resolvable configuration
Attributes
- intellijPlatformCollected = true
- intellijPlatformExtracted = true
- org.gradle.libraryelements = composed-jar
Extended Configurations
- intellijPlatformDependencies
- intellijPlatformDependency
- intellijPlatformTestDependencies
--------------------------------------------------
Configuration intellijPlatformTestDependencies
--------------------------------------------------
IntelliJ Platform Test Dependencies
--------------------------------------------------
Configuration intellijPluginVerifier
--------------------------------------------------
IntelliJ Plugin Verifier
--------------------------------------------------
Configuration intellijPluginVerifierIdes
--------------------------------------------------
IntelliJ Plugin Verifier IDEs
Attributes
- intellijPlatformExtracted = true
Extended Configurations
- intellijPluginVerifierIdesDependency
- intellijPluginVerifierIdesLocalInstance
--------------------------------------------------
Configuration intellijPluginVerifierIdesDependency
--------------------------------------------------
IntelliJ Plugin Verifier IDE dependencies
Attributes
- intellijPlatformExtracted = false
--------------------------------------------------
Configuration intellijPluginVerifierIdesLocalInstance
--------------------------------------------------
IntelliJ Plugin Verifier IDE local
Attributes
- intellijPlatformExtracted = true
--------------------------------------------------
Configuration jetbrainsRuntime
--------------------------------------------------
JetBrains Runtime
Attributes
- intellijPlatformExtracted = true
Extended Configurations
- jetbrainsRuntimeDependency
- jetbrainsRuntimeLocalInstance
--------------------------------------------------
Configuration jetbrainsRuntimeDependency
--------------------------------------------------
JetBrains Runtime dependency archive
Attributes
- intellijPlatformExtracted = false
--------------------------------------------------
Configuration jetbrainsRuntimeLocalInstance
--------------------------------------------------
JetBrains Runtime local instance
Attributes
- intellijPlatformExtracted = true
--------------------------------------------------
Configuration marketplaceZipSigner
--------------------------------------------------
Marketplace ZIP Signer
--------------------------------------------------
Configuration runtimeClasspath
--------------------------------------------------
Runtime classpath of source set 'main'.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = jar
- org.gradle.usage = java-runtime
Extended Configurations
- implementation
- runtimeOnly
--------------------------------------------------
Configuration testAnnotationProcessor
--------------------------------------------------
Annotation processors and their dependencies for source set 'test'.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.libraryelements = jar
- org.gradle.usage = java-runtime
--------------------------------------------------
Configuration testCompileClasspath
--------------------------------------------------
Compile classpath for source set 'test'.
Attributes
- intellijPlatformCollected = true
- intellijPlatformExtracted = true
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = composed-jar
- org.gradle.usage = java-api
Extended Configurations
- testCompileOnly
- testImplementation
--------------------------------------------------
Configuration testRuntimeClasspath
--------------------------------------------------
Runtime classpath of source set 'test'.
Attributes
- org.gradle.category = library
- org.gradle.dependency.bundling = external
- org.gradle.jvm.environment = standard-jvm
- org.gradle.jvm.version = 22
- org.gradle.libraryelements = jar
- org.gradle.usage = java-runtime
Extended Configurations
- testImplementation
- testRuntimeOnly
--------------------------------------------------
Compatibility Rules
--------------------------------------------------
The following Attributes have compatibility rules defined.
- org.gradle.dependency.bundling
- org.gradle.jvm.environment
- org.gradle.jvm.version
- org.gradle.libraryelements
- org.gradle.plugin.api-version
- org.gradle.usage
--------------------------------------------------
Disambiguation Rules
--------------------------------------------------
The following Attributes have disambiguation rules defined.
- org.gradle.category (1)
- org.gradle.dependency.bundling (5)
- org.gradle.jvm.environment (6)
- org.gradle.jvm.version (3)
- org.gradle.libraryelements (4)
- org.gradle.plugin.api-version
- org.gradle.usage (2)
(#): Attribute disambiguation precedence
BUILD SUCCESSFUL in 412ms
1 actionable task: 1 executed
### Steps to reproduce
In the description.
### Gradle IntelliJ Plugin version
2.1.0
### Gradle version
8.10.2
### Operating System
Linux
### Link to build, i.e. failing GitHub Action job
_No response_