You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/12/23 22:25:29 UTC

[GitHub] [maven] michael-o commented on a change in pull request #416: [MNG-4660] Increase usefulness of logging (2)

michael-o commented on a change in pull request #416:
URL: https://github.com/apache/maven/pull/416#discussion_r548293341



##########
File path: maven-core/src/main/java/org/apache/maven/ReactorReader.java
##########
@@ -263,15 +271,28 @@ private boolean isPackagedArtifactUpToDate( MavenProject project, File packagedA
             while ( iterator.hasNext() )
             {
                 Path outputFile = iterator.next();
+
+                if ( Files.isDirectory(  outputFile ) )
+                {
+                    continue;
+                }
+
                 long outputFileLastModified = Files.getLastModifiedTime( outputFile ).toMillis();
                 if ( outputFileLastModified > artifactLastModified )
                 {
-                    LOGGER.warn(
-                            "Packaged artifact for {} is not up-to-date compared to the build output directory; "
-                          + "file {} is more recent than {}.",
-                            project.getArtifactId(),
-                            relativizeOutputFile( outputFile ), relativizeOutputFile( packagedArtifactFile.toPath() )
-                    );
+                    File alternative = determineLooseDirectoryForArtifact( project, artifact );
+                    if ( alternative != null )
+                    {
+                        LOGGER.warn( "File {} is more recent than the packaged artifact for {}; using {} instead",

Review comment:
       Please put args to logging in single quotes if they are non-numbers or collections.

##########
File path: maven-core/src/main/java/org/apache/maven/ReactorReader.java
##########
@@ -263,15 +271,28 @@ private boolean isPackagedArtifactUpToDate( MavenProject project, File packagedA
             while ( iterator.hasNext() )
             {
                 Path outputFile = iterator.next();
+
+                if ( Files.isDirectory(  outputFile ) )
+                {
+                    continue;
+                }
+
                 long outputFileLastModified = Files.getLastModifiedTime( outputFile ).toMillis();
                 if ( outputFileLastModified > artifactLastModified )
                 {
-                    LOGGER.warn(
-                            "Packaged artifact for {} is not up-to-date compared to the build output directory; "
-                          + "file {} is more recent than {}.",
-                            project.getArtifactId(),
-                            relativizeOutputFile( outputFile ), relativizeOutputFile( packagedArtifactFile.toPath() )
-                    );
+                    File alternative = determineLooseDirectoryForArtifact( project, artifact );
+                    if ( alternative != null )
+                    {
+                        LOGGER.warn( "File {} is more recent than the packaged artifact for {}; using {} instead",
+                                relativizeOutputFile( outputFile ), project.getArtifactId(),
+                                relativizeOutputFile( alternative.toPath() ) );
+                    }
+                    else
+                    {
+                        LOGGER.warn( "File {} is more recent than the packaged artifact for {}; "
+                                + "cannot use a loose directory for this type of artifact",

Review comment:
       I have a bit of a problem with this: where is the defition of a "loose directory"?




----------------------------------------------------------------
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.

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