You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "michael-o (via GitHub)" <gi...@apache.org> on 2023/04/10 19:03:39 UTC

[GitHub] [maven-doxia-sitetools] michael-o commented on a diff in pull request #104: [DOXIASITETOOLS-301] Automatically remove the 0-byte site descriptors…

michael-o commented on code in PR #104:
URL: https://github.com/apache/maven-doxia-sitetools/pull/104#discussion_r1161994951


##########
doxia-integration-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java:
##########
@@ -911,6 +924,27 @@ private File resolveSiteDescriptor(
         return siteDescriptor;
     }
 
+    // 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);
+
+        try {
+            if (Files.exists(localArtifactPath) && Files.size(localArtifactPath) == 0L) {
+                LOGGER.debug(
+                        "Deleting 0-byte pseudo marker file for artifact '{}' at '{}'",
+                        request.getArtifact(),
+                        localArtifactPath);
+                Files.delete(localArtifactPath);
+            }
+        } catch (IOException e) {
+            // swallow

Review Comment:
   What wouls be the improvement if I log this here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org