ENV

  • jdk8
  • maven 3.8.1
  • sts 4.13
  • spring boot 2.6.3
  • win10

Question

maven build with long statement is prohibitively slow

Step

  1. use build-with-long-statement-is-prohibitively-slow.zip to repeat it;
  2. download and unzip it, then run: mvn clean package -X it keeped always in processing, no errors, no timeout, no more info, but in processing status.
  3. please focus on file: com.chwod.robot.action.general.service.relation.RelationMappingService there is a static block, it's containts a long statement. if remove it, then rebuild as step 2, it build complete quickly; so, until now, it seems that the maven build isn't support long statement. but, the interesting is:
  4. keeped the static block containts a long statement in that file, if remove parent block from the pom.xml,, it build complete quickly.

so, now, I can't be sure who's question this is. maven or spring? why not maven like spring or spring like maven? if not, I think spring can be fix it or avoid it.

BTW, I also submit a issue to maven repository, and hope: The two are reconciled, please refer: https://issues.apache.org/jira/projects/MNG/issues/MNG-7398

Comment From: michael-o

Close this ticket, it is not Spring-related. It is a bug in javac(1) which comes with OpenJDK 8, works on 11 and 16. See: https://issues.apache.org/jira/browse/MNG-7398?focusedCommentId=17481904&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17481904

Comment From: bclozel

I think it's a compiler issue with the source class you've written in your test project.

Using Java 11 builds quickly, as expected:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.637 s
[INFO] Finished at: 2022-01-25T16:47:27+01:00
[INFO] ------------------------------------------------------------------------

When the build is stuck in-flight, it looks like javac is busy with:

"main" #1 prio=5 os_prio=31 tid=0x00007f9cf8012000 nid=0x2303 runnable [0x0000700008295000]
   java.lang.Thread.State: RUNNABLE
    at java.lang.Object.hashCode(Native Method)
    at java.util.HashMap.hash(HashMap.java:340)
    at java.util.HashMap.get(HashMap.java:558)

I'm closing this issue as it looks like a javac problem and there's nothing we can do here. Could you report that to the javac team? Thanks!

Comment From: bclozel

Thanks @michael-o , it looks like we came to the same conclusion.

Comment From: chwod

@bclozel , @michael-o , Thank you for your quick response

Comment From: chwod

@bclozel , @michael-o , I submit an issue to the java team, it has been accepted, pleaes refer: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8280873