mthmulders commented on a change in pull request #416:
URL: https://github.com/apache/maven/pull/416#discussion_r548708451



##########
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:
       There's no formal definition of a "loose directory" - the term is taken 
from [this 
comment](https://github.com/apache/maven/blob/8eda091d4e2231eee3c33b4e9d417d62971d0762/maven-core/src/main/java/org/apache/maven/ReactorReader.java#L187).
   
   I think it is important to let the user know that the requested artifact 
could not be resolved from the workspace. How about this?
   
   > ... cannot use the build output directory for this type of artifact

##########
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:
       I wouldn't mind, but is that some new kind of rule? I see many other 
examples that do not follow that rule, like
   
   > Compiling 54 source files to 
/Users/maarten/Code/open-source/maven/maven/maven-model/target/classes
   
   or
   
   > skip non existing resourceDirectory 
/Users/maarten/Code/open-source/maven/maven/maven-xml/src/main/resources
   
   Both paths are non-numbers or collections, but they aren't between single 
quotes either.




----------------------------------------------------------------
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:
[email protected]


Reply via email to