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

Allow configuration of HTTP timeouts for maven repositories #3951

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ammachado
Copy link
Contributor

@ammachado ammachado commented Jan 27, 2024

What's changed?

Changed maven downloader to allow configuration of connection/read timeouts

What's your motivation?

https://maven.apache.org/guides/mini/guide-http-settings.html#connection-timeouts

Anything in particular you'd like reviewers to focus on?

No

Anyone you would like to review specifically?

No

Have you considered any alternatives or workarounds?

No

Any additional context

N/A

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@ammachado ammachado marked this pull request as ready for review January 29, 2024 13:28
Comment on lines +109 to +121
/**
* Constructor required by {@link org.openrewrite.gradle.marker.GradleProject}.
*
* @deprecated Use {@link #MavenRepository(String, String, String, String, boolean, String, String, Duration, Duration, Boolean)}
*/
@Deprecated
@JsonIgnore
public MavenRepository(
@Nullable String id, String uri, @Nullable String releases, @Nullable String snapshots, boolean knownToExist,
@Nullable String username, @Nullable String password, @Nullable Boolean deriveMetadataIfMissing
) {
this(id, uri, releases, snapshots, knownToExist, username, password, null, null, deriveMetadataIfMissing);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used by an external project, org.openrwrite.gradle.tooling:model.

@timtebeek
Copy link
Contributor

Nice addition @ammachado ! I'm tagging @sambsnyd for an additional review as we're adding fields to tree classes, and he reworked parts of the Maven repository handling recently.

Also copying the details on the failed test to save others a click

MavenPomDownloaderTest > centralIdOverridesDefaultRepository() FAILED
    java.lang.AssertionError: 
    Expecting elements:
      [MavenRepository(id=local, uri=file:///home/runner/.m2/repository, releases=true, snapshots=true, knownToExist=true, username=null, *** connectTimeout=null, readTimeout=null, deriveMetadataIfMissing=false),
        MavenRepository(id=central, uri=https://repo.maven.apache.org/maven2, releases=true, snapshots=false, knownToExist=true, username=null, *** connectTimeout=null, readTimeout=null, deriveMetadataIfMissing=true)]
    to be exactly 1 times URI https://internalartifactrepository.yourorg.com/
        at org.openrewrite.maven.internal.MavenPomDownloaderTest.centralIdOverridesDefaultRepository(MavenPomDownloaderTest.java:115)

@timtebeek timtebeek added the enhancement New feature or request label Feb 1, 2024
@ammachado
Copy link
Contributor Author

Nice addition @ammachado ! I'm tagging @sambsnyd for an additional review as we're adding fields to tree classes, and he reworked parts of the Maven repository handling recently.

Also copying the details on the failed test to save others a click

MavenPomDownloaderTest > centralIdOverridesDefaultRepository() FAILED
    java.lang.AssertionError: 
    Expecting elements:
      [MavenRepository(id=local, uri=file:///home/runner/.m2/repository, releases=true, snapshots=true, knownToExist=true, username=null, *** connectTimeout=null, readTimeout=null, deriveMetadataIfMissing=false),
        MavenRepository(id=central, uri=https://repo.maven.apache.org/maven2, releases=true, snapshots=false, knownToExist=true, username=null, *** connectTimeout=null, readTimeout=null, deriveMetadataIfMissing=true)]
    to be exactly 1 times URI https://internalartifactrepository.yourorg.com/
        at org.openrewrite.maven.internal.MavenPomDownloaderTest.centralIdOverridesDefaultRepository(MavenPomDownloaderTest.java:115)

As a suggestion, can you consider publishing the test reports on a failed build? Perhaps using a custom action for it (for example, https://github.com/marketplace/actions/junit-report-action).

@timtebeek
Copy link
Contributor

As a suggestion, can you consider publishing the test reports on a failed build? Perhaps using a custom action for it (for example, https://github.com/marketplace/actions/junit-report-action).

Yes I'd been eyeing https://github.com/gradle/actions/tree/main/setup-gradle#build-reporting earlier today, as part of our upgrade in https://github.com/openrewrite/gh-automation/ . It's been a pain point of mine as well to have to go into the logs.

@timtebeek timtebeek self-requested a review February 6, 2024 23:21
@timtebeek timtebeek removed their request for review March 15, 2024 09:37
@timtebeek timtebeek self-requested a review May 4, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

2 participants