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

JvmTestSuites unable to see dependencies from "implementation project()" #25269

Closed
jimshowalter opened this issue Jun 2, 2023 · 3 comments
Closed
Labels
closed:duplicate Duplicated or superseeded by another issue

Comments

@jimshowalter
Copy link

jimshowalter commented Jun 2, 2023

Expected Behavior

According to Gradle's documentation, JvmTestSuites such as componentTest, integrationTest, etc. should be able to see the dependencies for the production code under src/main/java, when they are configured to include "implementation project()"

Current Behavior

The dependencies are not visible, and builds fail.

In the simple example attached, the dependency on json is not seen.

The README.md has a command you can run to provoke the compile error.

In our actual service, JvmTestSuites also can't see code in src/main/java, but we were unable to create a simplified example of that.

Context (optional)

We're trying to migrate off the unbroken-dome testSets and onto JvmTestSuites so we can upgrade to Gradle 8.x.

Steps to Reproduce

gradle-upgrade-poc.zip

See the README.md for how to reproduce the errors.

Gradle version

8.1.1

Build scan URL (optional)

With compileClasspath and runtimeClasspath explicitly set: https://gradle.com/s/loy376waco254

With compileClasspath and runtimeClasspath commented out: https://gradle.com/s/xxg4acb3tixgi

Your Environment (optional)

Mac M1 with all latest patches.

@jimshowalter
Copy link
Author

Here's an example of someone else reporting the same kind of problem: https://stackoverflow.com/questions/76041835/using-main-dependencies-in-integration-test-in-gradle-jvm-test-suite-plugin

@jimshowalter
Copy link
Author

git cloned this repo, search for implementation project(), and found it in a few unit tests, but nowhere did I see a test that verifies that classes in src/main/java are seen by the test suites.

@eskatos
Copy link
Member

eskatos commented Jun 7, 2023

Thank you for your interest in Gradle!

This issue will be closed as a duplicate of

Please add your use case and 👍 to that issue.


Your test suite with a dependency on project() can see the api transitive dependencies of the main component at compilation time and the implementation transitive dependencies of the main component at runtime.

If your test uses json, explicitly declare the dependency in your test suite while the linked issue is unsolved.

@eskatos eskatos closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
@eskatos eskatos added closed:duplicate Duplicated or superseeded by another issue and removed a:bug to-triage labels Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:duplicate Duplicated or superseeded by another issue
Projects
None yet
Development

No branches or pull requests

2 participants