You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/04/10 19:19:15 UTC
[maven-doxia-sitetools] branch DOXIASITETOOLS-301 updated: Address comments
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch DOXIASITETOOLS-301
in repository https://gitbox.apache.org/repos/asf/maven-doxia-sitetools.git
The following commit(s) were added to refs/heads/DOXIASITETOOLS-301 by this push:
new 2dff0e5 Address comments
2dff0e5 is described below
commit 2dff0e5b598818e2ef7a4d13870869b3bb1f2a70
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Apr 10 21:19:10 2023 +0200
Address comments
---
.../apache/maven/doxia/tools/DefaultSiteTool.java | 23 ++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
index bc7ed41..0b48ffe 100644
--- a/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
+++ b/doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
@@ -30,7 +30,6 @@ import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
@@ -76,7 +75,8 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.LocalArtifactRequest;
+import org.eclipse.aether.repository.LocalArtifactResult;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.ArtifactRequest;
@@ -926,22 +926,25 @@ public class DefaultSiteTool implements SiteTool {
// TODO Remove this transient method when everyone has migrated to Maven Site Plugin 4.0.0+
private void deletePseudoSiteDescriptorMarkerFile(RepositorySystemSession repoSession, ArtifactRequest request) {
- LocalRepository localRepository = repoSession.getLocalRepository();
LocalRepositoryManager lrm = repoSession.getLocalRepositoryManager();
- String relativeLocalArtifactPath = lrm.getPathForLocalArtifact(request.getArtifact());
- Path localArtifactPath = localRepository.getBasedir().toPath().resolve(relativeLocalArtifactPath);
+ LocalArtifactRequest localRequest = new LocalArtifactRequest();
+ localRequest.setArtifact(request.getArtifact());
+
+ LocalArtifactResult localResult = lrm.find(repoSession, localRequest);
+ File localArtifactFile = localResult.getFile();
try {
- if (Files.exists(localArtifactPath) && Files.size(localArtifactPath) == 0L) {
+ if (localResult.isAvailable() && Files.size(localArtifactFile.toPath()) == 0L) {
+
LOGGER.debug(
"Deleting 0-byte pseudo marker file for artifact '{}' at '{}'",
- request.getArtifact(),
- localArtifactPath);
- Files.delete(localArtifactPath);
+ localRequest.getArtifact(),
+ localArtifactFile);
+ Files.delete(localArtifactFile.toPath());
}
} catch (IOException e) {
- // swallow
+ LOGGER.debug("Failed to delete 0-byte pseudo marker file for artifact '{}'", localRequest.getArtifact());
}
}