redhat-developer / redhat-developer/vscode-java

Dependency with scope test in gradle falls into the main classpath

Open
#3,777 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Gradle
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

[provide a description of the issue]

Environment
  • Operating System: MacOs
  • JDK version: 17
  • Visual Studio Code version: 1.93.1
  • Java extension version: v1.34.0
Steps To Reproduce

The gradle project. If there is a dependency on another module in a multi-module project with scope test, then this dependency falls into the main classpath.

Current Result

In build.gradle.kts

  testImplementation(project(":backend:core:model"))
  testImplementation(project(":backend:core:ports"))

In .classpath of this module

	<classpathentry kind="src" path="/ports">
		<attributes>
			<attribute name="gradle.buildServer" value="true"/>
		</attributes>
	</classpathentry>
		<classpathentry kind="src" path="/model">
		<attributes>
			<attribute name="gradle.buildServer" value="true"/>
		</attributes>
	</classpathentry>
Expected Result

In .classpath of this module

	<classpathentry kind="src" path="/ports">
		<attributes>
			<attribute name="test" value="true"/>
			<attribute name="gradle.buildServer" value="true"/>
		</attributes>
	</classpathentry>
		<classpathentry kind="src" path="/model">
		<attributes>
			<attribute name="test" value="true"/>
			<attribute name="gradle.buildServer" value="true"/>
		</attributes>
	</classpathentry>
Additional Informations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the multi-module Gradle project and inspect build.gradle.kts alongside the generated .classpath entries. Reproduce the testImplementation dependency behavior, then verify that affected source entries receive the test=true attribute while retaining gradle.buildServer=true.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.