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

Regression in MavenPomDownloader from 8.42.0 #5085

Open
BoykoAlex opened this issue Feb 21, 2025 · 2 comments · May be fixed by #5086
Open

Regression in MavenPomDownloader from 8.42.0 #5085

BoykoAlex opened this issue Feb 21, 2025 · 2 comments · May be fixed by #5086
Labels
bug Something isn't working

Comments

@BoykoAlex
Copy link
Contributor

Consider this unit test:

(The test merely attempts to resolve dependencies and check if compile scope has proper number of dependencies)

    @Test
    void resolveDependencies() throws MavenDownloadingExceptions {
        Xml.Document doc = (Xml.Document) MavenParser.builder().build().parse("""
                  <project>
                      <parent>
                          <groupId>org.springframework.boot</groupId>
                          <artifactId>spring-boot-starter-parent</artifactId>
                          <version>3.2.0</version>
                          <relativePath/>
                      </parent>
                      <groupId>com.example</groupId>
                      <artifactId>demo</artifactId>
                      <version>0.0.1-SNAPSHOT</version>
                      <name>demo</name>
                      <dependencies>
                          <dependency>
                              <groupId>org.springframework.boot</groupId>
                              <artifactId>spring-boot-starter-web</artifactId>
                          </dependency>
                      </dependencies>
                  </project>
        """).toList().get(0);
        MavenResolutionResult resolutionResult = doc.getMarkers().findFirst(MavenResolutionResult.class).orElseThrow();
        resolutionResult = resolutionResult.resolveDependencies(new MavenPomDownloader(Collections.emptyMap(), new InMemoryExecutionContext(), null, null), new InMemoryExecutionContext());
        List<ResolvedDependency> deps = resolutionResult.getDependencies().get(Scope.Compile);
        assertThat(deps).hasSize(34);
    }

With version 8.42.0 and above the number of dependencies is 0. It is 0 because of this (change)[https://github.com//pull/4738/files#diff-80e53987f9ebb9e28874fed7053378def4769cef75b303770ccc8ee085fac098]

What happens is that for local maven repo if the JAR is around we wouldn't attempt to download the POM using another maven repo. I'm not sure how to correct this yet... probably if we've tried all repos and find a JAR for one of them then we can probably return the artificial POM based on the GAV only...

@BoykoAlex BoykoAlex added the bug Something isn't working label Feb 21, 2025
@BoykoAlex BoykoAlex linked a pull request Feb 21, 2025 that will close this issue
@BoykoAlex
Copy link
Contributor Author

I've attached the PR but perhaps it is best to revert the change that caused the regression... If we are downloading the POM and failed to so why not throw exception regardless of the JAR presence?

@BoykoAlex
Copy link
Contributor Author

@MBoegers and @sambsnyd could you please have a look at this issue? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant