Skip to content

Commit

Permalink
Always extract coordinates part in the same way
Browse files Browse the repository at this point in the history
  • Loading branch information
dnestoro committed Nov 7, 2024
1 parent a133fc4 commit fbba242
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ final String METADATA_GROUP = "Metadata"

List<String> getNewerVersionsFor(String library, String startingVersion) {
def baseUrl = "https://repo1.maven.org/maven2"
String group = library.split(":")[0].replace(".", "/")
String artifact = library.split(":")[1]
String[] libraryParts = library.split(":")
String group = libraryParts[0].replace(".", "/")
String artifact = libraryParts[1]
def data = new URL(baseUrl + "/" + group + "/" + artifact + "/" + "maven-metadata.xml").getText()

return tck.getNewerVersionsFromLibraryIndex(data, startingVersion, library)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ List<String> getMetadataFileList(Path directory) throws IOException {

String getLatestLibraryVersion(String libraryModule) {
try {
List<String> coordinates = List.of(libraryModule.split(":"));
String group = coordinates.get(0);
String artifact = coordinates.get(1);
String[] coordinates = libraryModule.split(":");
String group = coordinates[0];
String artifact = coordinates[1];

File coordinatesMetadataIndex = new File("metadata/" + group + "/" + artifact +"/index.json");
ObjectMapper objectMapper = new ObjectMapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ void setLastSupportedVersion(String version) {

@TaskAction
void run() throws IllegalStateException, IOException {
List<String> GAVCoordinates = Arrays.stream(coordinates.split(":")).toList();
if (GAVCoordinates.size() != 3) {
String[] coordinatesParts = coordinates.split(":");
if (coordinatesParts.length != 3) {
throw new IllegalArgumentException("Maven coordinates should have 3 parts");
}

String group = GAVCoordinates.get(0);
String artifact = GAVCoordinates.get(1);
String version = GAVCoordinates.get(2);
String group = coordinatesParts[0];
String artifact = coordinatesParts[1];
String version = coordinatesParts[2];
Coordinates c = new Coordinates(group, artifact, version);
addToMetadataIndexJson(c);
}
Expand Down

0 comments on commit fbba242

Please sign in to comment.