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

Getting Gradle versions from gradle.properties #1618

Open
MarounMaroun opened this issue Jan 9, 2020 · 18 comments
Open

Getting Gradle versions from gradle.properties #1618

MarounMaroun opened this issue Jan 9, 2020 · 18 comments
Labels
F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. Keep Exempt this from being marked by stalebot L: java:gradle Maven packages via Gradle T: feature-improvement Requests to improve existing features Workaround 🔁 Workaround for an upstream bug or unsupported feature

Comments

@MarounMaroun
Copy link

My build.gradle has dependencies like:

dependency "org.assertj:assertj-core:${assertJVersion}"

The variable assertJVersion is resolved from the gradle.properties file.

Is there a way to configure the bot to resolve the version from this file?

@meck93
Copy link

meck93 commented Feb 18, 2020

Another option would be to resolve the variable assertJVersion via the
ext { assertJVersion = '1.1.1.1' } section in the build.gradle.

I'm also not sure if this currently works? Does anyone know?

@stale stale bot added the stale label Apr 18, 2020
@mirland
Copy link

mirland commented Apr 18, 2020

From my point of view this is one of the most important issues of this bot, so I think this shouldn't be closed.

@mercuriete
Copy link

mercuriete commented Jun 20, 2020

I have dependencies like:

    def daggerVersion = 2.20
    implementation "com.google.dagger:dagger:$daggerVersion"
    implementation "com.google.dagger:dagger-android:$daggerVersion"
    implementation "com.google.dagger:dagger-android-support:$daggerVersion"
    kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
    kapt "com.google.dagger:dagger-compiler:$daggerVersion"
    kapt "com.google.dagger:dagger-android-support:$daggerVersion"
    kaptTest "com.google.dagger:dagger-compiler:$daggerVersion"

So in this case is mandatory to bump lots of dependencies to the same version and not one by one.

I understand this problem is difficult to resolve, thank in advance!

In the meantime I think is better to hardcode all dependencies to the same version and let dependabot tries to do whatever it wanted to do.

Thank for this project 👍

@ashughes
Copy link

@mercuriete I was very pleasantly surprised that this worked!

@mercuriete
Copy link

Sorry for the noise if this is offtopic

@ashughes what do you mean about "this worked"?
The snipped that I put was from some tutorial from internet, I am doing something wrong?

The problem is dependabot is not intelligent enough to search def variables and create a PR with my example.

If you mean the workaround that I proposed... I didn't test it yet. I am not sure that dependabot is working with hardcoded versions per each line I dont want to change my master branch to do that test, probably I will end up doing a test on an copy of my repository.

Thanks to the dependabot team for the amazing work.

@ashughes
Copy link

@mercuriete I wasn't sure whether or not you were suggesting this as working, but I tried it and it did work, so I assumed you were. 😛

I have 3 dependencies that all use the same version, but they each specified the version individually:

implementation 'com.fasterxml.jackson.core:jackson-core:2.8.4'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.4'

Dependabot created 3 PRs to change each of these individually. After reading your comment I changed the above to the following on my main branch:

def jacksonVersion = "2.8.4"
implementation "com.fasterxml.jackson.core:jackson-core:$jacksonVersion"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"

Then Dependabot closed all 3 of the previous PRs and opened a new one that just changed jacksonVersion to 2.11.1! And it even included the release notes for all 3 of the dependencies (well, at least as much as it did on the individual PRs).

Basically, doing this appears to be a great workaround for #1296.

@mercuriete
Copy link

@ashughes thanks for the clarification I need to investigate more, because that is what is not working for me.
Maybe I need more coffee xD.

@mercuriete
Copy link

mercuriete commented Aug 17, 2020

@ashughes
Sorry for the noise...
I just changed my snippet from the one is described above... for this one:mercuriete/android-musician-tools@a4de664

build.gradle on root folder

    ext.dagger_version = '2.20'

build.gradle on app folder

    implementation "com.google.dagger:dagger:$dagger_version"
    implementation "com.google.dagger:dagger-android:$dagger_version"
    implementation "com.google.dagger:dagger-android-support:$dagger_version"
    kapt "com.google.dagger:dagger-android-processor:$dagger_version"
    kapt "com.google.dagger:dagger-compiler:$dagger_version"
    kapt "com.google.dagger:dagger-android-support:$dagger_version"
    kaptTest "com.google.dagger:dagger-compiler:$dagger_version"

and it started to work.
So sorry for the noise that I introduced here but dependabot works for my use case.

Thanks to all the people involved in this issue.

rm3l added a commit to rm3l/mac-oui that referenced this issue Nov 2, 2020
There is an open issue in dependabot-core [1].
So this serves as a workaround until this issue is fixed.

[1] dependabot/dependabot-core#1618
@hmarr hmarr added L: java:gradle Maven packages via Gradle F: language-support Issues specific to a particular language or ecosystem; may be paired with an L: label. labels Feb 3, 2021
@StefanOltmann
Copy link

Any updates on this?

I also define my versions in gradle.properties as this feels very right to do so.

mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue May 21, 2021
We do not want dependabot to update the dependencies of test projects.
As there is no option to disable dependabot for a directory, enable it
only for the where we want it to run.

Note that we do not enable dependabot for Gradle because it does not
support defining versios in gradle.propertes [1] and we manually check
for Gradle dependency updates using the `dependencyUpdates` Gradle task
on a regular basis.

[1] dependabot/dependabot-core#1618

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue May 21, 2021
We do not want dependabot to update the dependencies of test projects.
As there is no option to disable dependabot for a directory, enable it
only for the projects where we want it to run.

Note that we do not enable dependabot for Gradle because it does not
support defining versios in gradle.propertes [1] and we manually check
for Gradle dependency updates using the `dependencyUpdates` Gradle task
on a regular basis.

[1] dependabot/dependabot-core#1618

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
@sschuberth
Copy link

sschuberth commented May 21, 2021

IMO the only sane way to address this is by implementing:

mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue May 21, 2021
We do not want dependabot to update the dependencies of test projects.
As there is no option to disable dependabot for a directory, enable it
only for the projects where we want it to run.

Note that we do not enable dependabot for Gradle because it does not
support defining versions in gradle.propertes [1] and we manually check
for Gradle dependency updates using the `dependencyUpdates` Gradle task
on a regular basis.

[1] dependabot/dependabot-core#1618

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
mnonnenmacher added a commit to oss-review-toolkit/ort that referenced this issue May 21, 2021
We do not want dependabot to update the dependencies of test projects.
As there is no option to disable dependabot for a directory, enable it
only for the projects where we want it to run.

Note that we do not enable dependabot for Gradle because it does not
support defining versions in gradle.propertes [1] and we manually check
for Gradle dependency updates using the `dependencyUpdates` Gradle task
on a regular basis.

[1] dependabot/dependabot-core#1618

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
@marcindabrowski
Copy link

I have versions defined as below:

project.ext.versions = [
        kotlin                       : '1.5.0',
        kotlin_logging               : '1.12.5',
        wiremock                     : '2.28.0',
]

and dependencies :

dependencies {
    implementation group: 'io.github.microutils', name: 'kotlin-logging', version: versions.kotlin_logging
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: versions.kotlin
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: versions.kotlin
    implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: versions.kotlin
    integration group: 'com.github.tomakehurst', name: 'wiremock-jre8-standalone', version: versions.wiremock
}

and it didn't bump kotlin to 1.5.10

@cricketsamya
Copy link

cricketsamya commented Oct 20, 2021

@patkujawa-wf
Copy link

Try this out https://cricketsamya.github.io/posts/dependabot-with-gradle/

@cricketsamya I'm giving that a try, thanks! The url markdown was malformed, though. https://www.sameerkulkarni.de/posts/dependabot-with-gradle/ is the link.

After updating, I ran dependabot and got this error, though the logs seem to indicate all is well (and up to date)

Dependabot encountered an unknown error
Dependabot failed to update your dependencies because an unexpected error occured. See the logs for more details.

Might need to wait until the next kotlin or spring release to see if it works or broke things for my project.

@cricketsamya
Copy link

@patkujawa-wf sorry for the link! If possible just downgrade one of the dependencies and run dependabot again to see the results.

@patkujawa-wf
Copy link

Just saw it work with Kotlin 1.6.0! Thanks again for the tip.

@mccartney
Copy link

@SimonScholz
Copy link

https://www.sameerkulkarni.de/posts/dependabot-with-gradle/ is the link.

For anyone curious, this gives 404 now. Web Archive has this post: https://web.archive.org/web/20220125120756/https://www.sameerkulkarni.de/posts/dependabot-with-gradle/

Thanks for sharing this, but IMHO this should be addressed by Dependabot.
If Gradle can read the versions from the gradle.properties file then Dependabot should also be capable of doing so.

@jeffwidman jeffwidman added the Workaround 🔁 Workaround for an upstream bug or unsupported feature label Feb 4, 2023
@dependabot dependabot deleted a comment from stale bot Feb 4, 2023
@JakubLedworowski
Copy link

Hi, what is the status of this - is Dependabot's plan to address reading from gradle.properties?
I saw an effort being completed here #6249 which is a nice way of organizing dependencies, but I just wondered if the gradle.properties way is also on the roadmap. Thanks.

@abdulapopoola abdulapopoola added the T: feature-improvement Requests to improve existing features label Mar 28, 2023
@abdulapopoola abdulapopoola moved this to Untriaged in Dependabot Mar 30, 2023
Snidd111 added a commit to aws/c3r that referenced this issue Mar 31, 2023
*Issue #, if available:*
- Some of our dependencies need to be kept in sync
(hadoop/spark/freefair/etc). Dependabot doesn't update more than one at
a time unless the version is parameterized.

*Description of changes:*
- Consolidates `gradle.build` file similarities
- Migrates versions that are coupled to parameters
- Based on behavior mentioned in the comments here:
dependabot/dependabot-core#1618

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
notdryft added a commit to gatling/gatling-grpc-demo that referenced this issue Dec 13, 2023
Dependabot doesn't know how to update variables.
See dependabot/dependabot-core#1618
@jonjanego jonjanego added the Keep Exempt this from being marked by stalebot label May 2, 2024
sanderploegsma added a commit to exercism/java-test-runner that referenced this issue May 6, 2024
This should make Dependabot group dependency updates to the Jackson libraries, as suggested here: dependabot/dependabot-core#1618 (comment)
sanderploegsma added a commit to exercism/java-test-runner that referenced this issue May 7, 2024
)

* Bump com.fasterxml.jackson.core:jackson-core from 2.17.0 to 2.17.1

Bumps [com.fasterxml.jackson.core:jackson-core](https://github.com/FasterXML/jackson-core) from 2.17.0 to 2.17.1.
- [Commits](FasterXML/jackson-core@jackson-core-2.17.0...jackson-core-2.17.1)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Group version updates for jackson libraries

This should make Dependabot group dependency updates to the Jackson libraries, as suggested here: dependabot/dependabot-core#1618 (comment)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sander Ploegsma <sanderploegsma@gmail.com>
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. Keep Exempt this from being marked by stalebot L: java:gradle Maven packages via Gradle T: feature-improvement Requests to improve existing features Workaround 🔁 Workaround for an upstream bug or unsupported feature
Projects
Status: Planned
Development

No branches or pull requests