diff --git a/pom.xml b/pom.xml index a251e7c8eb8..e6991f401e8 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ UTF-8 - 3.9.11 + 3.9.12 org.rascalmpl.shell.RascalShell 3 11 diff --git a/src/org/rascalmpl/util/maven/Artifact.java b/src/org/rascalmpl/util/maven/Artifact.java index 238f00a1872..473371f41b0 100644 --- a/src/org/rascalmpl/util/maven/Artifact.java +++ b/src/org/rascalmpl/util/maven/Artifact.java @@ -112,8 +112,8 @@ public Dependency getOrigin() { } /** - * The path where the jar is located, can be null in case we couldn't resolve it - * Note, for the root project, it's will always be null, as we won't resolve it to a location in the repository. + * The path where the jar is located, can be null in case we could not resolve it. + * Note, for the root project, it is always null, as it will not be resolved to a location in the repository. */ public @Nullable Path getResolved() { return resolved; diff --git a/src/org/rascalmpl/util/maven/HttpRepositoryDownloader.java b/src/org/rascalmpl/util/maven/HttpRepositoryDownloader.java index 4b5b67c6a0c..95408d013d9 100644 --- a/src/org/rascalmpl/util/maven/HttpRepositoryDownloader.java +++ b/src/org/rascalmpl/util/maven/HttpRepositoryDownloader.java @@ -220,10 +220,10 @@ private boolean moveToTarget(Path from, Path to, boolean force) throws IOExcepti return false; } finally { try { - // Delete temperory file if something went wrong + // Delete temporary file if something went wrong Files.deleteIfExists(from); } catch (IOException ignored) { - // Beste effort + // Best effort } } } diff --git a/src/org/rascalmpl/util/maven/SimpleResolver.java b/src/org/rascalmpl/util/maven/SimpleResolver.java index ac7b2187784..c1acce82845 100644 --- a/src/org/rascalmpl/util/maven/SimpleResolver.java +++ b/src/org/rascalmpl/util/maven/SimpleResolver.java @@ -30,7 +30,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -93,7 +92,7 @@ public SimpleResolver createChildResolver() { } public SimpleResolver createSiblingResolver(String parentGroupId, Path parentPath) { - return new SiblingResolver(rootRepository, client, mirrors, servers, parentResolver, parentGroupId, parentPath); + return new SiblingResolver(rootRepository, client, mirrors, servers, this, parentGroupId, parentPath); } public Path calculatePomPath(ArtifactCoordinate coordinate) { diff --git a/test/org/rascalmpl/util/maven/MavenResolverTest.java b/test/org/rascalmpl/util/maven/MavenResolverTest.java index 1a8fa009a6b..561121b7784 100644 --- a/test/org/rascalmpl/util/maven/MavenResolverTest.java +++ b/test/org/rascalmpl/util/maven/MavenResolverTest.java @@ -30,7 +30,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeThat; import java.io.IOException; import java.nio.file.Files; @@ -114,6 +113,18 @@ public void localReferenceIsAvailableInModel() throws ModelResolutionError { assertNull("non-existing test lib should not be found", testLib.getResolved()); } + @Test + public void resolveParentDependencies() throws ModelResolutionError { + var parser = createParser("multi-module/example-core/pom.xml"); + var project = parser.parseProject(); + var resolved = project.resolveDependencies(Scope.COMPILE, parser); + var maybeRascalLsp = locate(resolved, "rascal-lsp"); + + assertTrue("rascal-lsp dependency should be found", maybeRascalLsp.isPresent()); + var rascalLsp = maybeRascalLsp.get(); + assertNotNull("rascal-lsp should be resolved to a path", rascalLsp.getResolved()); + } + @Test public void multiModulePomsWorkWithSiblings() throws ModelResolutionError { var parser = createParser("multi-module/example-ide/pom.xml"); @@ -126,6 +137,7 @@ public void multiModulePomsWorkWithSiblings() throws ModelResolutionError { assertTrue("Rascal-lsp should be found", maybeRascalLsp.isPresent()); assertEquals("rascal-lsp should be resolved to the right version", "2.21.2", maybeRascalLsp.get().getCoordinate().getVersion()); + assertNotNull("rascal-lsp should resolved to a path", maybeRascalLsp.get().getResolved()); var maybeCoreLink = locate(resolved, "example-core"); diff --git a/test/org/rascalmpl/util/maven/poms/multi-module/example-core/pom.xml b/test/org/rascalmpl/util/maven/poms/multi-module/example-core/pom.xml index 858783c03f8..a9ea0e57adc 100644 --- a/test/org/rascalmpl/util/maven/poms/multi-module/example-core/pom.xml +++ b/test/org/rascalmpl/util/maven/poms/multi-module/example-core/pom.xml @@ -16,10 +16,6 @@ io.usethesource capsule - - org.rascalmpl - rascal-lsp - org.rascalmpl typepal diff --git a/test/org/rascalmpl/util/maven/poms/multi-module/example-ide/pom.xml b/test/org/rascalmpl/util/maven/poms/multi-module/example-ide/pom.xml index bc4dd6d5af6..7a1b027d8d2 100644 --- a/test/org/rascalmpl/util/maven/poms/multi-module/example-ide/pom.xml +++ b/test/org/rascalmpl/util/maven/poms/multi-module/example-ide/pom.xml @@ -13,10 +13,6 @@ - - org.rascalmpl - rascal-lsp - org.rascalmpl example-core diff --git a/test/org/rascalmpl/util/maven/poms/multi-module/pom.xml b/test/org/rascalmpl/util/maven/poms/multi-module/pom.xml index e66b3899f74..07ad971a2fd 100644 --- a/test/org/rascalmpl/util/maven/poms/multi-module/pom.xml +++ b/test/org/rascalmpl/util/maven/poms/multi-module/pom.xml @@ -24,6 +24,13 @@ 1.0.0-SNAPSHOT + + + org.rascalmpl + rascal-lsp + + +