Skip to content

Commit

Permalink
Merge pull request #30922 from iocanel/fix-maven-coords-parsing
Browse files Browse the repository at this point in the history
Fix dependency parsing in JBangBuilderImpl
  • Loading branch information
gsmet authored Feb 9, 2023
2 parents dbd6cb4 + ea6b0b7 commit 89f4607
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ public static Map<String, Object> postBuild(Path appClasses, Path pomFile, List<
.setManagingProject(new GACTV("io.quarkus", "quarkus-bom", "", "pom", getQuarkusVersion()))
.setForcedDependencies(dependencies.stream().map(s -> {
String[] parts = s.getKey().split(":");
// The format of maven coordinate used in what jbang calls `canonical` form.
// The form is described here: https://github.com/jbangdev/jbang/blob/main/src/main/java/dev/jbang/dependencies/MavenCoordinate.java#L118
// Despite the fact that is non standard it's still used for compatibility reasons by the IntegrationManager:
// https://github.com/jbangdev/jbang/blob/main/src/main/java/dev/jbang/spi/IntegrationManager.java#L73
Dependency artifact;
if (parts.length == 3) {
artifact = new ArtifactDependency(parts[0], parts[1], null, ArtifactCoords.TYPE_JAR, parts[2]);
} else if (parts.length == 4) {
artifact = new ArtifactDependency(parts[0], parts[1], null, parts[2], parts[3]);
} else if (parts.length == 5) {
artifact = new ArtifactDependency(parts[0], parts[1], parts[3], parts[2], parts[4]);
artifact = new ArtifactDependency(parts[0], parts[1], parts[2], parts[3], parts[4]);
} else {
throw new RuntimeException("Invalid artifact " + s.getKey());
}
Expand Down

0 comments on commit 89f4607

Please sign in to comment.