Skip to content
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 pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-version>3.9.11</maven-version>
<maven-version>3.9.12</maven-version>
<exec.mainClass>org.rascalmpl.shell.RascalShell</exec.mainClass>
<rascal.test.memory>3</rascal.test.memory>
<maven.compiler.release>11</maven.compiler.release>
Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/util/maven/Artifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/util/maven/HttpRepositoryDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/org/rascalmpl/util/maven/SimpleResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 13 additions & 1 deletion test/org/rascalmpl/util/maven/MavenResolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<groupId>io.usethesource</groupId>
<artifactId>capsule</artifactId>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-lsp</artifactId>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>typepal</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@


<dependencies>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-lsp</artifactId>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>example-core</artifactId>
Expand Down
7 changes: 7 additions & 0 deletions test/org/rascalmpl/util/maven/poms/multi-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
<example.version>1.0.0-SNAPSHOT</example.version>
</properties>

<dependencies>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-lsp</artifactId>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down
Loading