-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK11 breaks incremental compilation #600
Comments
Also a diff between two invocations of mvn -X compile: one when the plugin decides to recompile everything and one where it decides that there is nothing to recompile. --- nok 2022-05-10 23:11:21.058018406 +0200
+++ ok 2022-05-10 23:12:10.817908605 +0200
@@ -218,7 +218,7 @@
<session default-value="${session}"/>
</configuration>
[DEBUG] =======================================================================
-[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=50882, ConflictMarker.markTime=237926, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=27156, ConflictIdSorter.topsortTime=491179, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1297117, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=222495, DefaultDependencyCollector.transformTime=3665894}
+[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=39355, ConflictMarker.markTime=170048, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=19208, ConflictIdSorter.topsortTime=351513, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=861743, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=126626, DefaultDependencyCollector.transformTime=2545553}
[DEBUG] G:A:jar:1.2.3-SNAPSHOT
[INFO]
[INFO] --- scala-maven-plugin:4.6.1:add-source (add-source) @ A ---
@@ -227,7 +227,7 @@
[DEBUG] Using mirror maven-default-http-blocker (http://0.0.0.0/) for repository.jboss.org (http://repository.jboss.org/maven2).
[DEBUG] Using mirror maven-default-http-blocker (http://0.0.0.0/) for snapshots.jboss.org (http://snapshots.jboss.org/maven2).
[DEBUG] Using mirror maven-default-http-blocker (http://0.0.0.0/) for oss.sonatype.org/jboss-snapshots (http://oss.sonatype.org/content/repositories/jboss-snapshots).
-[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=1158238, ConflictMarker.markTime=401752, ConflictMarker.nodeCount=224, ConflictIdSorter.graphTime=344556, ConflictIdSorter.topsortTime=68622, ConflictIdSorter.conflictIdCount=76, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=6021203, ConflictResolver.conflictItemCount=156, DefaultDependencyCollector.collectTime=279112888, DefaultDependencyCollector.transformTime=8079883}
+[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=1111817, ConflictMarker.markTime=294304, ConflictMarker.nodeCount=224, ConflictIdSorter.graphTime=324008, ConflictIdSorter.topsortTime=69775, ConflictIdSorter.conflictIdCount=76, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=5976739, ConflictResolver.conflictItemCount=156, DefaultDependencyCollector.collectTime=271602963, DefaultDependencyCollector.transformTime=7878041}
[DEBUG] net.alchim31.maven:scala-maven-plugin:jar:4.6.1
[DEBUG] org.apache.maven.shared:maven-dependency-tree:jar:3.1.0:compile
[DEBUG] org.apache.maven:maven-core:jar:3.0.5:compile
@@ -361,7 +361,7 @@
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ A ---
[DEBUG] Using mirror maven-default-http-blocker (http://0.0.0.0/) for snapshots (http://snapshots.maven.codehaus.org/maven2).
[DEBUG] Using mirror maven-default-http-blocker (http://0.0.0.0/) for central (http://repo1.maven.org/maven2).
-[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=414301, ConflictMarker.markTime=150527, ConflictMarker.nodeCount=77, ConflictIdSorter.graphTime=208467, ConflictIdSorter.topsortTime=34693, ConflictIdSorter.conflictIdCount=26, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1089605, ConflictResolver.conflictItemCount=74, DefaultDependencyCollector.collectTime=76741613, DefaultDependencyCollector.transformTime=1937977}
+[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=252925, ConflictMarker.markTime=103188, ConflictMarker.nodeCount=77, ConflictIdSorter.graphTime=115615, ConflictIdSorter.topsortTime=41435, ConflictIdSorter.conflictIdCount=26, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=683761, ConflictResolver.conflictItemCount=74, DefaultDependencyCollector.collectTime=55408679, DefaultDependencyCollector.transformTime=1228206}
[DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:2.6
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG] org.apache.maven:maven-project:jar:2.0.6:compile
@@ -457,7 +457,7 @@
[DEBUG] -- end configuration --
[DEBUG] Checking for multiple versions of scala
[DEBUG] building maven31 dependency graph for G:A:jar:1.2.3-SNAPSHOT with Maven31DependencyGraphBuilder
-[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=57612, ConflictMarker.markTime=24441, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=16039, ConflictIdSorter.topsortTime=8017, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=17998, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=5443, DefaultDependencyCollector.transformTime=141036}
+[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=30205, ConflictMarker.markTime=19124, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=2754, ConflictIdSorter.topsortTime=4687, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=12748, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=3872, DefaultDependencyCollector.transformTime=82106}
[DEBUG] G:A:jar:1.2.3-SNAPSHOT
[DEBUG] /tmp/1/x
[DEBUG] includes = [**/*.java,**/*.scala,]
@@ -470,41 +470,13 @@
[DEBUG] IncrementalCompile.incrementalCompile
[DEBUG] previous = Stamps for: 2 products, 1 sources, 1 libraries
[DEBUG] current source = Set(/tmp/1/x/X.scala)
-[DEBUG] Invalidating '/modules/java.base/java/lang/Object.class' because could not find class java.lang.Object on the classpath.
-[DEBUG] > initialChanges = InitialChanges(Changes(added = Set(), removed = Set(), changed = Set(), unmodified = ...),Set(),Set(/modules/java.base/java/lang/Object.class),API Changes: Set())
-[DEBUG]
-Initial source changes:
- removed: Set()
- added: Set()
- modified: Set()
-Invalidated products: Set()
-External API changes: API Changes: Set()
-Modified binary dependencies: Set(/modules/java.base/java/lang/Object.class)
-Initial directly invalidated classes: Set()
-Sources indirectly invalidated by:
- product: Set()
- binary dep: Set(/tmp/1/x/X.scala)
- external source: Set()
-[DEBUG] all 1 sources are invalidated
-[DEBUG] Initial set of included nodes:
-[DEBUG] Recompiling all sources: number of invalidated sources > 50.0% of all sources
-[DEBUG] compilation cycle 1
-[INFO] compiling 1 Scala source to /tmp/1/x/target/classes ...
-[DEBUG] Returning already retrieved and compiled bridge: /home/user/.sbt/1.0/zinc/org.scala-sbt/org.scala-sbt-compiler-bridge_2.13-1.6.1-bin_2.13.8__55.0-1.6.1_20220117T214008.jar.
-[DEBUG] [zinc] Running cached compiler 5c0e2ec for Scala compiler version 2.13.8
-[DEBUG] [zinc] The Scala compiler is invoked with:
- -target:11
- -bootclasspath
-
- -classpath
- /tmp/1/x/target/classes:/home/user/.m2/repository/org/scala-lang/scala-compiler/2.13.8/scala-compiler-2.13.8.jar:/home/user/.m2/repository/org/scala-lang/scala-library/2.13.8/scala-library-2.13.8.jar:/home/user/.m2/repository/org/scala-lang/scala-reflect/2.13.8/scala-reflect-2.13.8.jar:/home/user/.m2/repository/org/jline/jline/3.21.0/jline-3.21.0.jar:/home/user/.m2/repository/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar
-[DEBUG] Scala compilation took 1.834386269 s
-[INFO] done compiling
-[INFO] compile in 2.6 s
+[DEBUG] > initialChanges = InitialChanges(Changes(added = Set(), removed = Set(), changed = Set(), unmodified = ...),Set(),Set(),API Changes: Set())
+[DEBUG] No changes
+[INFO] compile in 0.7 s
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ A ---
[DEBUG] Using mirror maven-default-http-blocker (http://0.0.0.0/) for apache-snapshots (http://people.apache.org/repo/m2-snapshot-repository).
-[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=499995, ConflictMarker.markTime=113040, ConflictMarker.nodeCount=160, ConflictIdSorter.graphTime=123469, ConflictIdSorter.topsortTime=39339, ConflictIdSorter.conflictIdCount=43, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=841605, ConflictResolver.conflictItemCount=63, DefaultDependencyCollector.collectTime=78985831, DefaultDependencyCollector.transformTime=1646633}
+[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=269487, ConflictMarker.markTime=111715, ConflictMarker.nodeCount=160, ConflictIdSorter.graphTime=161126, ConflictIdSorter.topsortTime=35722, ConflictIdSorter.conflictIdCount=43, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=821047, ConflictResolver.conflictItemCount=63, DefaultDependencyCollector.collectTime=87372899, DefaultDependencyCollector.transformTime=1424546}
[DEBUG] org.apache.maven.plugins:maven-compiler-plugin:jar:3.1
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.9:compile
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.9:compile
@@ -587,4 +559,3 @@
[DEBUG] Output directory: /tmp/1/x/target/classes
[DEBUG] CompilerReuseStrategy: reuseCreated
[DEBUG] useIncrementalCompilation enabled
-[INFO] Nothing to compile - all classes are up to date |
@eed3si9n Could you please share some insights? I can reproduce with zinc 1.6.1 and 1.7.0-M2. Is in a bug in zinc, or in the way we use zinc? |
@slandelle Sorry I don't really have a clear understanding of how that works. What I know is that to accommodate JDK 9 we wrote a program that moves I also have a vague recollection of faking any |
@eed3si9n Thanks a lot for chiming in!
|
The weird invalidation only happens during the first run following a full compile.
Meaning the issue is probably with the analysis store when it's created for the first time. |
Remove the FileConverter, it seems to break things.
Please upgrade to 4.6.2 |
Thank you! It works fine now. |
Maybe this change needs a manual flag or be applied conditionally when java 9 or higher is detected?
|
Sad. Most likely related to what happens in Zinc here: https://github.com/sbt/zinc/pull/982/files Please chime in if you can create a reproducer. |
Looks the same as #615 |
Running maven with JDK11 triggers recompilation of all source files in project. When it happens, the following can be found in the mvn -X log:
If I use java 8 to compile the same project, then everything works fine, the plugin properly reports "[DEBUG] No changes". With java 11 it's quite random, but most often it just recompiles everything.
The test project consist of two files. pom.xml:
And an arbitrary scala class like x.scala:
The given test project can be cloned from the gist:
java -version
full trace for mvn -X compile:
The text was updated successfully, but these errors were encountered: