renovatebot / config-help

Please use the Discussions feature of https://github.com/renovatebot/renovate instead
https://github.com/renovatebot/renovate/discussions
MIT License
27 stars 16 forks source link

How to manage a project with both Maven and Gradle builds? #919

Closed Xendar closed 4 years ago

Xendar commented 4 years ago

Which Renovate are you using?

Self hosted bot using Docker image in a Jenkins pipeline

Which platform are you using?

Bitbucket Server

Have you checked the logs? Don't forget to include them if relevant

What would you like to do?

I have a project that has both Maven and Gradle builds scripts. Renovate manages to process both of them, but they are managed it seems independently.

As an example I have a MapStruct dependency:

Root POM:

<properties>
  <mapstruct.version>1.4.0.Final</mapstruct.version>
</properties>

<dependencyManagement>
  <dependencies>
      <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${mapstruct.version}</version>
      </dependency>
  </dependencies>
</dependencyManagement>

<build>
  <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <release>11</release>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
          <annotationProcessorPaths>
            <path>
              <groupId>org.mapstruct</groupId>
              <artifactId>mapstruct-processor</artifactId>
              <version>${mapstruct.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
</build>

build.gradle:

dependencies {
  constraints {
    implementation "org.mapstruct:mapstruct:${mapstructVersion}"
    annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
  }
}

gradle.properties:

mapstructVersion=1.4.0.Final

Now that a version 1.4.1.Final is out, Renovate generates 3 PRs for me (my renovate.json does not contain anything in particular for this dependency):

mapstruct gradle annotation processor

mapstruct gradle

mapstruct maven

There is one thing, about the Gradle PRs, where the existing version is considered to be the name of the variable instead of its value (that may be a bug?). But in the context of this ticket, I was wondering if there is a way to have a single PR to update both Maven and Gradle dependencies at the same time?

rarkins commented 4 years ago

If you think they should always be grouped and updated together and everyone would want that then you could submit a PR to add them to https://github.com/renovatebot/renovate/blob/master/lib/config/presets/internal/monorepo.ts

Otherwise, you can write you own packageRules and rely on packagePatterns for matching.

The mapstructVersion above looks like a bug. @zharinov ?

zharinov commented 4 years ago

The mapstructVersion above looks like a bug. @zharinov ?

Looks so, though earlier we already fixed something similar

rarkins commented 4 years ago

@Xendar can you reproduce the mapStruct bug in a public repo?

Xendar commented 4 years ago

If you think they should always be grouped and updated together and everyone would want that then you could submit a PR to add them to https://github.com/renovatebot/renovate/blob/master/lib/config/presets/internal/monorepo.ts

Well, I think it could make sense, but maybe it should be driven by some configuration parameter, I'll try to have a look and better understand how it works

Otherwise, you can write you own packageRules and rely on packagePatterns for matching.

True, however, that would oblige me to write rules for each and every dependency groups in my project, and I have lots of them :(

@Xendar can you reproduce the mapStruct bug in a public repo?

Good point (as I cannot share mine which is internal to my company), I'll try to put it in place!

Xendar commented 4 years ago

Hello @rarkins @zharinov I created a public repo with a super simple configuration: https://github.com/Xendar/renovate-bot-gradle-deps And configured Renovate, we just need it to run now to hopefully reproduce the issue :)

zharinov commented 4 years ago

Thanks for repo, unfortunately I wasn't able to reproduce it

Xendar commented 4 years ago

Thanks for repo, unfortunately I wasn't able to reproduce it

Yes I saw :'( Would you have any idea on what factor could introduce this kind of behaviour? Else I'll try to add more elements to see what could do it

zharinov commented 4 years ago

I found related issue, will refresh corresponding PR soon: https://github.com/renovatebot/renovate/issues/7300

Xendar commented 4 years ago

I found related issue, will refresh corresponding PR soon: renovatebot/renovate#7300

Going through the issue I may have found why my repo did not reproduce the issue. I did a commit to try to reproduce it :)

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon if no further activity occurs.

rarkins commented 4 years ago

@Xendar @zharinov let's close out this config help issue and open a bug in the main repo if you need