Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency with scope test in gradle falls into the main classpath #3777

Open
Daniil-Ivanov1 opened this issue Sep 25, 2024 · 7 comments
Open

Comments

@Daniil-Ivanov1
Copy link

Daniil-Ivanov1 commented Sep 25, 2024

[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
@snjeza
Copy link
Contributor

snjeza commented Sep 25, 2024

@Daniil-Ivanov1 Could you try to add

"java.gradle.buildServer.enabled": "off",

to your settings.json

@Daniil-Ivanov1
Copy link
Author

@snjeza Then Spring Boot Tests stop working

@snjeza
Copy link
Contributor

snjeza commented Sep 25, 2024

@Daniil-Ivanov1 Do you have a project example reproducing the issue?

@Daniil-Ivanov1
Copy link
Author

@snjeza This is my work project and I can't upload its source code

@snjeza
Copy link
Contributor

snjeza commented Sep 26, 2024

@Daniil-Ivanov1 Could you try to add

apply plugin: 'eclipse'
eclipse {
  classpath {
    file {
      whenMerged {
        entries.findAll { it.path == '/ports' || it.path == '/model' }
          .each { it.entryAttributes['test'] = 'false' }
      }
    }
  }
}

to your build.gradle

@jdneo
Copy link
Collaborator

jdneo commented Sep 27, 2024

Could you share the content of build.gradle file and .classpath?

@Daniil-Ivanov1
Copy link
Author

@jdneo This is a working project, I can't share its source code, but I can try to reproduce this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants