Skip to content

It seems that the settings.xml file is not taken into account when downloading dependencies #876

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

Closed
IvoNet opened this issue Aug 22, 2023 · 1 comment
Labels
type: bug Something isn't working

Comments

@IvoNet
Copy link

IvoNet commented Aug 22, 2023

Describe the bug
A clear and concise description of what the bug is.

At work we use a private repository for maven artifacts and we need credentials for that.
It seems that this is not taken into account bu the scan.
When I add the <repository> tag to the pom.xml it does try to use it but then the credentials fail as they still come from the settings.xml file and it fails on a 401.

It might also be that the Server settings in the settings.xml do not work with username and password but with:

<server>
            <id>gitlab-maven</id>
            <configuration>
                <httpHeaders>
                    <property>
                        <name>Private-Token</name>
                        <value>TOKEN_HERE</value>
                    </property>
                </httpHeaders>
            </configuration>
        </server>

SBM Version
local build version v0.15.2-SNAPSHOT

SBM Application
shell

To Reproduce
Steps to reproduce the behavior:

1 scan any project without tag in the pom but with different settings.xml configuration settings and credentials set in a settings-security.xml file end credentials in the settings.xml file

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

downloading of the dependencies in the pom should work from the provided repo in the settings.xml and not from the pom or the default maven repo.

Or a way to configure which repo to use with which credentials

Stacktrace
If applicable, add the (sanitized) stacktrace here.

Caused by: org.openrewrite.maven.MavenDownloadingExceptions
at org.openrewrite.maven.MavenDownloadingExceptions.append(MavenDownloadingExceptions.java:47)
at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:184)
at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:124)
... 30 more
Suppressed: org.openrewrite.maven.MavenDownloadingException: REDACTED failed. Unable to download POM. Tried repositories:
REDACTED: HTTP 401
https://repo.maven.apache.org/maven2: Did not attempt to download because of a previous failure to retrieve from this repository.
at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:561)
at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:579)
at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:502)
at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:179)
... 31 more
Suppressed: org.openrewrite.maven.MavenDownloadingException: REDACTED failed. Unable to download POM. Tried repositories:
REDACTED: HTTP 401
https://repo.maven.apache.org/maven2: Did not attempt to download because of a previous failure to retrieve from this repository.
at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:561)
at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:579)
at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:502)
at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:179)
... 31 more
Suppressed: org.openrewrite.maven.MavenDownloadingException: REDACTED failed. Unable to download POM. Tried repositories:
REDACTED: HTTP 401
at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:561)
at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:579)
at org.openrewrite.maven.tree.ResolvedPom.resolveDependencies(ResolvedPom.java:502)
at org.openrewrite.maven.tree.MavenResolutionResult.resolveDependencies(MavenResolutionResult.java:179)
... 31 more

Desktop (please complete the following information):

  • OS: [e.g. Windows]
  • Version [e.g. 10]

MacOs M1

Additional context
Add any other context about the problem here.

@IvoNet IvoNet added the type: bug Something isn't working label Aug 22, 2023
@fabapp2
Copy link
Contributor

fabapp2 commented Aug 25, 2023

Hi @IvoNet
That's right. This is tracked in #880 and will be added to the new parser component.
Using the RewriteMavenProjectParser in sbm-support-rewrite should work to parse a given project to OpenRewrite AST.
Also see #859

@fabapp2 fabapp2 closed this as completed Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants