Reputation: 642
I have a micronaut(1.2.5) project which uses gradle. The build time is very slow. I have tried the following:
org.gradle.jvmargs=-Xmx4048m -XX:MaxPermSize=1024m
org.gradle.caching=true
org.gradle.daemon=true
which seem to have no affect in the build time.
I noticed I was getting this log in startup
> Task :compileJava
Note: Creating bean classes for 539 type elements
When I have smaller no. of classes such as 100, the build time is better and seems to get worse as the project grows larger.
I can't help with the no. of classes the project has and it may continue to grow more in the future. Is there some way to enhance build time when having large no. of classes?
This is the profile that was generated
Upvotes: 2
Views: 1060
Reputation: 9082
You could try to split your application into modules and release them as separate jars. For example when using Micronaut Data move the persistence layer containing JPA entities and repositories into its own module (jar) and then include it as a dependency into your Micronaut application.
With that approach Micronaut must not process your JPA entities within each build.
Micronaut does ahead of time compilation which means that all context data (bean definitions, dependency wiring, ...) are created a compile time (build time). This means you pay the price (timewise) at compilation time but gain even more time at runtime.
Upvotes: 1