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

[MNG-7743] Make the build work on JDK 20 #1065

Merged
merged 5 commits into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/maven_build_itself.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java: [8, 17]
java: [8, 17, 20]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,20 @@ public class TestRepositoryConnector implements RepositoryConnector {

public TestRepositoryConnector(RemoteRepository repository) {
this.repository = repository;
try {
URL url = new URL(repository.getUrl());
if ("file".equals(url.getProtocol())) {
basedir = new File(url.getPath());
String repositoryUrl = repository.getUrl();
if (repositoryUrl.contains("${")) {
Copy link
Contributor Author

@psiroky psiroky Mar 18, 2023

Choose a reason for hiding this comment

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

This is somewhat ugly, but I haven't really found a better way at this point (without some major changes in how the TestRepositoryConnector is being used}.

Basically either the TestRepositoryConnector would need to resolve the properties in the URL, or the constructor would have to be called with a RemoteRepository object which already has these resolved.

The single test that was failing (ProjectBuilderTest.testLocationTrackingResolution) does not really care about the location as far as I can tell.

// the repository url contains unresolved properties and getting the basedir is not possible
// in JDK 20+ 'new URL(string)' will fail if the string contains a curly brace
this.basedir = null;
} else {
try {
URL url = new URL(repository.getUrl());
if ("file".equals(url.getProtocol())) {
basedir = new File(url.getPath());
}
} catch (MalformedURLException e) {
throw new IllegalStateException(e);
}
} catch (MalformedURLException e) {
throw new IllegalStateException(e);
}
}

Expand Down