You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "olamy (via GitHub)" <gi...@apache.org> on 2023/01/29 21:21:51 UTC

[GitHub] [maven-compiler-plugin] olamy commented on a diff in pull request #172: [MCOMPILER-525] - Incremental recompile incorrect detection of dependency change

olamy commented on code in PR #172:
URL: https://github.com/apache/maven-compiler-plugin/pull/172#discussion_r1090053416


##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -1733,30 +1740,46 @@ protected boolean isDependencyChanged()
             fileExtensions = Collections.unmodifiableList( Arrays.asList( "class", "jar" ) );
         }
 
-        Date buildStartTime = getBuildStartTime();
+        Instant buildStartTime = getBuildStartTime();
 
         List<String> pathElements = new ArrayList<>();
         pathElements.addAll( getClasspathElements() );
         pathElements.addAll( getModulepathElements() );
         
         for ( String pathElement : pathElements )
         {
-            File artifactPath = new File( pathElement );
-            if ( artifactPath.isDirectory() || artifactPath.isFile() )
+            Path artifactPath = Paths.get( pathElement );
+
+            // Search files only on dependencies (other modules), not the current project.
+            if ( Files.isDirectory( artifactPath ) && !artifactPath.equals( getOutputDirectory().toPath() ) )
             {
-                if ( hasNewFile( artifactPath, buildStartTime ) )
+                try ( Stream<Path> walk = Files.walk( artifactPath ) )

Review Comment:
   I need to review more this. At this may have bad performance impact on large projects with a lot of modules and large source code (e.g source files number).
   this PR https://github.com/apache/maven-compiler-plugin/pull/163 use another path by storing some information rather than walking again and again the same source tree.



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