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
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ final String[] format(String moduleName, Iterable<? extends Path> paths) {
*/
@Override
public String toString() {
return "PathType[" + id() + "]";
return "PathType[" + id() + ']';
}

/**
Expand Down Expand Up @@ -325,7 +325,7 @@ public JavaPathType rawType() {
*/
@Override
public String id() {
return JavaPathType.this.name() + ":" + moduleName;
return JavaPathType.this.name() + ':' + moduleName;
}

/**
Expand Down Expand Up @@ -405,7 +405,7 @@ public boolean equals(Object obj) {
@Nonnull
@Override
public String toString() {
return "PathType[" + id() + "]";
return "PathType[" + id() + ']';
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
*
* <p><dfn>Project aggregation</dfn> allows building several projects together. This is only
* for projects that are built, hence available on the file system. One project,
* called the <dfn>aggregator project</dfn> lists one or more <dfn>modules</dfn>
* called the <dfn>aggregator project</dfn> lists one or more <dfn>sub-projects</dfn>
* which are relative pointers on the file system to other projects. This is done using
* the {@code /project/modules/module} elements of the POM in the aggregator project.
* the {@code /project/subprojects/subproject} elements of the POM in the aggregator project.
* Note that the aggregator project is required to have a {@code pom} packaging.</p>
*
* <p><dfn>Project inheritance</dfn> defines a parent-child relationship between projects.
Expand Down
36 changes: 26 additions & 10 deletions impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,29 @@ private void installIntoProjectLocalRepository(Artifact artifact) {
Path target = getArtifactPath(
artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), classifier, extension);
try {
LOGGER.info("Copying {} to project local repository", artifact);
Files.createDirectories(target.getParent());
Files.copy(
artifact.getPath(),
target,
StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES);
// Log nothing as creating links should be very fast.
Path source = artifact.getPath();
if (!(Files.isRegularFile(target) && Files.isSameFile(source, target))) {
Files.createDirectories(target.getParent());
try {
Files.deleteIfExists(target);
Files.createLink(target, source);
} catch (UnsupportedOperationException | IOException suppressed) {
LOGGER.info("Copying {} to project local repository.", artifact);
try {
Files.copy(
source,
target,
StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES);
} catch (IOException e) {
e.addSuppressed(suppressed);
throw e;
}
}
}
} catch (IOException e) {
LOGGER.error("Error while copying artifact to project local repository", e);
LOGGER.error("Error while copying artifact " + artifact + " to project local repository.", e);
}
}

Expand All @@ -481,9 +495,11 @@ private Path getArtifactPath(
.resolve(artifactId)
.resolve(version)
.resolve(artifactId
+ "-" + version
+ '-'
+ version
+ (classifier != null && !classifier.isEmpty() ? "-" + classifier : "")
+ "." + extension);
+ '.'
+ extension);
}

private Path getProjectLocalRepo() {
Expand Down