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

Shadowing dependencies // Problem with scope 'implementation' vs. 'compile' #656

Closed
1azyman opened this issue May 12, 2021 · 5 comments
Closed
Assignees
Milestone

Comments

@1azyman
Copy link

1azyman commented May 12, 2021

With gradle 7, compile dependency scope was deprecated/removed. Proper replacement should be implementation scope.
However dependencies added with implementation scope are added "after" ideaIC, which means all "shadowed" dependencies like apache velocity will not work correctly.

Sample repository: example

Dependency lists are in scope*.txt files

Changing scope implementation to compile will fix dependency issues and build ends with success.

@Pushpavel
Copy link

I too faced this same issue. adding the below code fixed it for me.

configurations {
    all {
        // Allows using project dependencies instead of IDE dependencies during compilation and test running
        resolutionStrategy.sortArtifacts(ResolutionStrategy.SortOrder.DEPENDENCY_FIRST)
    }
}

this code is from the Rust plugin.

@YannCebron YannCebron changed the title Problem with scope 'implementation' vs. 'compile' Problem with scope 'implementation' vs. 'compile' // shadowing dependencies Dec 14, 2021
@YannCebron YannCebron pinned this issue Dec 14, 2021
@YannCebron YannCebron changed the title Problem with scope 'implementation' vs. 'compile' // shadowing dependencies Shadowing dependencies // Problem with scope 'implementation' vs. 'compile' Dec 14, 2021
@hsz hsz added this to the Next milestone Feb 17, 2022
@hsz hsz removed this from the next milestone Mar 28, 2022
@andysenn
Copy link

I also ran into this issue in an IntelliJ Platform Plugin project when I tried to use the org.jetbrains.kotlin.plugin.serialization Gradle plugin.

Despite explicitly adding a dependency of org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2, I would always get the following error at compile time:

Your current kotlinx.serialization core version is too low, while current Kotlin compiler plugin 1.6.10 requires at least 1.0-M1-SNAPSHOT. Please update your kotlinx.serialization runtime dependency.

I was able to get this working by using the workaround @Pushpavel provided, though I'm not sure if this is a good long-term solution.

@hsz hsz added this to the next milestone Jun 8, 2022
hsz added a commit that referenced this issue Jun 8, 2022
…path` and `testCompileClasspath` configurations #656
hsz added a commit that referenced this issue Jun 8, 2022
…path` and `testCompileClasspath` configurations #656
@hsz hsz self-assigned this Jun 8, 2022
@hsz hsz added the enhancement label Jun 8, 2022
@hsz
Copy link
Member

hsz commented Jun 8, 2022

With the next release, the ResolutionStrategy.SortOrder.DEPENDENCY_FIRST resolution strategy will be enabled by default for compileClasspath and testCompileClasspath configurations.

It'll be possible to disable it, in terms of any potential troubles, with the build feature flag:

org.jetbrains.intellij.buildFeature.useDependencyFirstResolutionStrategy = false

hsz added a commit that referenced this issue Jun 8, 2022
…path` and `testCompileClasspath` configurations #656
@hsz hsz closed this as completed Jun 8, 2022
@hsz hsz unpinned this issue Jun 27, 2022
@hsz
Copy link
Member

hsz commented Aug 1, 2022

Fix delivered with 1.7.0 isn't correct. Another one applied with #1060 – see comments for more details.

@cjbrooks12
Copy link

I'm still getting this issue with plugin version v1.10.0. The above DEPENDENCY_FIRST workaround doesn't fix it, and the comments in #1060 suggest this issue has been fixed in 1.8.0, but it seems like it's still an issue. Here's the configuration I'm using, v1.5.2 is the latest version I'm able to work with, anything later fails with the kotlinx.serialization version issue

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

No branches or pull requests

5 participants