I have a cross Java-clojure project that uses maven as the build tool. AOT compiling of some of the namespaces are required.
The problem is, the compilation takes like forever to complete. Inspecting the maven process gives the following observations:
- When compiling, the CPU wait time is very high (single core 70-90%).
Sampling that high wait thread gives a stack where the innermost calls are:
at java.io.FileDescriptor.sync(Native Method) at clojure.lang.Compiler.writeClassFile(Compiler.java:7269)
- Checking the
target/classes/
folder, a great number of.class
files are generated, mostly for the clojure-based libraries on which my project depends.
What I have tried:
- Instructed the clojure-maven-plugin to compile only given namespaces. But the propagation along the dependency line is not inhibited.
- Explicitly included given namespaces, and excluded the namespace of dependency. The dependency library is still recompiled by the AOT process.
Well, just before I pressed the "POST" button, I found this issue. It seems back in 5 years we've had such discussion, and the problem is not specific to clojure-maven-plugin. So what's new about this issue? It takes about 4 minutes to mvn clean compile
once on my machine for my not-so-huge project, and I can literally grab a coffee, sit back and relax..
If the issue is not to be resolved in any way in the near future, what might be suggested to mitigate my pain? Any thought are welcome.
mvn clean compile
now took only 40+ seconds! From 4 MINUTES! If using myclean.sh
, only 20+ seconds. – Davyzhu