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

Gradle: add support for dependencies in buildSrc #2180

Closed
Tapchicoma opened this issue Mar 18, 2019 · 17 comments · Fixed by ministryofjustice/hmpps-probation-integration-services#322
Labels
F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. L: java:gradle Maven packages via Gradle T: feature-request Requests for new features

Comments

@Tapchicoma
Copy link

Gradle has a concept of buildSrc (https://docs.gradle.org/current/userguide/organizing_gradle_projects.html#sec:build_sources) that provides logic for the project build files.

Also it is possible to define there a dependencies (even using common Kotlin files): https://github.com/JLLeitschuh/ktlint-gradle/blob/master/plugin/buildSrc/src/main/kotlin/PluginDependencies.kt

Please add support to updating dependencies defined in buildSrc folder in Groovy, Java or Kotlin file (please also keep in mind closed dependabot/feedback#392)

@infin8x infin8x transferred this issue from dependabot/feedback Jun 29, 2020
@infin8x infin8x added L: java:gradle Maven packages via Gradle T: feature-request Requests for new features F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. labels Jul 2, 2020
@JavierSegoviaCordoba
Copy link

JavierSegoviaCordoba commented Nov 2, 2020

Gradle 6.8 will include a new official dependencies management.

Source: gradle/gradle#14896

@sindrenm
Copy link

sindrenm commented Jan 30, 2021

Apologies for bumping this thread, but I felt it was worth mentioning that the new dependencies management moved over to the 7.0 RC1 milestone on December 8. In case you're already on 6.8 and want to try this out, as I was. Further progress is tracked in gradle/gradle#15352.

@JavierSegoviaCordoba
Copy link

Gradle 7.0 milestone1 is available and the stable version should be available before February ends.

@savvisingh
Copy link

What happened to the support for buildSrc?

@JavierSegoviaCordoba
Copy link

What happened to the support for buildSrc?

You should stop using buildSrc and move to catalogs, it is not recommend by Gradle.

@sindrenm
Copy link

sindrenm commented Aug 6, 2021

Version catalogs is what was introduced in 7.0. It's still in preview, however.

https://docs.gradle.org/current/userguide/platforms.html

@TSRBerry
Copy link

TSRBerry commented Nov 18, 2021

What happened to the support for buildSrc?

You should stop using buildSrc and move to catalogs, it is not recommend by Gradle.

How is it not recommended by Gradle? I have been following their guide to setup my multi-project build and was told to use buildSrc for that.
See here:
https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html#sec:convention_plugins

They even mention project dependencies specifically and declare a dependency on junit:junit:4.13 in their example:
https://docs.gradle.org/current/userguide/declaring_dependencies_between_subprojects.html#sec:project_jar_dependencies

It would be pretty nice if dependabot was able to scan the files under buildSrc as well, since Gradle in my eyes still wants people to use buildSrc to share build logic in multi-project builds.

@JavierSegoviaCordoba
Copy link

Because it breaks some caches. There is multiple workaround to use catalogs inside precompiled plugins.

@TSRBerry
Copy link

TSRBerry commented Nov 18, 2021

Are you saying that Gradle wants me to use some workarounds to use catalogs with buildSrc? Why would they still recommend precompiled plugins over catalogs for multi-project builds then?

I thought this was a bug of dependabot which is how I got here and am a bit confused about the state of this issue. Since according to my understanding Gradle still wants people to use buildSrc.

Even if workarounds exist to make it work I don't want to put in extra effort to reconfigure the project and potentially mess something up.

If dependabot is not going to support this case that's fine with me. I'll need to monitor the dependencies myself then, so some kind of heads up about that would be appreciated.

Edit: reworded my initial question, since it sounded quite rude and I think I misunderstood the comment above.

@JavierSegoviaCordoba
Copy link

@jeliebig, I didn't say you should use one or another, using catalogs doesn't imply not using precompiled catalogs.

I am using precompiled plugins AND catalogs every single day, for single or multi-project builds.

I was using precompiled plugins + dependency management in buildSrc since 2019 and I still use precompiled plugins but without having the dependency management in buildSrc, moving it to Version Catalogs.

Why do you have to hardcode the strings + versions directly in the precompiled plugins and/or buildSrc object/classes instead of getting the catalog INSIDE buildSrc precompiled plugins and get the deps from there, and adding them to the dependencies block in your precompiled plugin?

You should use Version Catalogs for dependency management, something completely unrelated to precompiled plugin feature. You can get the deps from the Version Catalogs and apply them inside buildSrc precompiled plugins.

That means if you update your deps, you have to change nothing in buildSrc, avoiding breaking cache.

@TSRBerry
Copy link

Oh that doesn't sound that hard to do!
I thought workarounds means that I would have to follow some kind of complicated process to get something to work that isn't supposed to work.

But what you just described sounds pretty easy to me. I guess I'll give it another try and see if it works.

Although it doesn't solve this issue, this might be acceptable to just get it working at the moment.

Thank you for your patience with me!

KengoTODA added a commit to spotbugs/spotbugs that referenced this issue Dec 28, 2021
we need an isolated config until the following issue is resolved:
dependabot/dependabot-core#2180
mkutz added a commit to mkutz/Shakespeare that referenced this issue Jan 21, 2022
According to dependabot/dependabot-core#2180 Dependabot does not support
buildSrc dependencies (yet).

Hence, dependencies should not be defined there.

Closes #76
mkutz added a commit to mkutz/Shakespeare that referenced this issue Jan 21, 2022
According to dependabot/dependabot-core#2180 Dependabot does not support
buildSrc dependencies (yet).

Hence, dependencies should not be defined there.

Closes #76
mkutz added a commit to mkutz/Shakespeare that referenced this issue Jan 25, 2022
According to dependabot/dependabot-core#2180 Dependabot does not support
buildSrc dependencies (yet).

Hence, dependencies should not be defined there.

Closes #76
mkutz added a commit to mkutz/Shakespeare that referenced this issue Jan 25, 2022
According to dependabot/dependabot-core#2180 Dependabot does not support
buildSrc dependencies (yet).

Hence, dependencies should not be defined there.

Closes #76
mkutz added a commit to mkutz/Shakespeare that referenced this issue Jan 26, 2022
According to dependabot/dependabot-core#2180 Dependabot does not support
buildSrc dependencies (yet).

Hence, dependencies should not be defined there.

Closes #76
@Goooler
Copy link

Goooler commented Feb 8, 2022

Complex build logics still need buildSrc, any plan to support this feature?

@wartingep
Copy link

did this just got released? I see a lot of PR:s in my buildsrc today :)

@mwierzchowski
Copy link

Same here. Looks like "something" was released. Where can we find any details?

@mwierzchowski
Copy link

Alright, found minute after asking a question (so typical...). See: #5028

@deivid-rodriguez
Copy link
Contributor

deivid-rodriguez commented Oct 17, 2022

So.. this can be closed now?? 😮 🎉

@deivid-rodriguez
Copy link
Contributor

I'll do a reaction-driven issue close then! :)

marcus-bcl added a commit to ministryofjustice/hmpps-probation-integration-services that referenced this issue Oct 28, 2022
This is no longer needed (and results in duplicate PRs), following this issue being closed: dependabot/dependabot-core#2180
marcus-bcl added a commit to ministryofjustice/hmpps-probation-integration-services that referenced this issue Oct 28, 2022
This is no longer needed (and results in duplicate PRs), following this issue being closed: dependabot/dependabot-core#2180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. L: java:gradle Maven packages via Gradle T: feature-request Requests for new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants