Skip to content

Gradle dependencies yielded via [implementation files] are not respected #1657

@Vassilena-Treneva-IBM

Description

@Vassilena-Treneva-IBM

Extension Name: vscode-gradle
Extension Version: 3.16.4
OS Version: Windows
VSCode version: 1.98.2

Describe the bug
Dependency declarations like this one are not taken into account when importing a gradle project:

project.tasks.classes.dependsOn(project(":vehicle").tasks.classes)
dependencies {
    implementation files(project(":vehicle").sourceSets.main.output.classesDirs)
}

Despite being a bad-practise some projects use this approach and this is a valid gradle syntax.

To Reproduce
Attaching a sample gradle zipped project, which builds successfully using a command line: gradlew assemble
vscode fails to import it despite that gradle builds it.
sample.zip

Expected behavior
The IDE should do as Gradle does - import the project successfully

Screenshots

Image

Output from "Gradle for Java"
There is no actual error here, looks as if runs ok:

[info] [gradle-server] Gradle Server started, listening on 60301
[info] Gradle client connected to server
[info] Java Home: C:\Users\VasilenaTreneva\.vscode\extensions\redhat.java-1.40.0-win32-x64\jre\21.0.6-win32-x86_64
[info] JVM Args: --add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Dfile.encoding=UTF-8,-Duser.country=GB,-Duser.language=en,-Duser.variant
[info] Gradle User Home: C:\Users\VasilenaTreneva\.gradle
[info] Gradle Version: 7.3.3
[info] Project reference :vehicle created from directory: [C:\git\sample\vehicle]
Project reference :motor-vehicle created from directory: [C:\git\sample\motor-vehicle]
Using Gradle home..........C:\Users\VasilenaTreneva\.gradle\wrapper\dists\gradle-7.3.3-v6-bin\4xp2f2mmy2wcgu3rcku1k31tb\gradle-7.3.3
Using Gradle user home.....C:\Users\VasilenaTreneva\.gradle

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE SUCCESSFUL in 23s
[info] Found 84 tasks
[info] Build file opened: c:\git\sample\build.gradle
[info] Build file opened: c:\git\sample\motor-vehicle\build.gradle

Does the bug still exist if you disable all other extensions?
Yes

Additional context
I am trying vscode buildship integration (build server is disabled) so I find it weird why I see this line on top of the stdout:
[info] [gradle-server] Gradle Server started, listening on 60301

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions