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

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

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


##########
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:
   Hi @olamy, now you can review this, I don't expect any bad performance even on large projects, I have tested this vs the 3.10.1 version on a large project without any drawback.
   
   Additionally, I have included a small perf improvement for the evaluation of the cause of recompilation.
   
   Thanks!



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