Hi,
When building a Quarkus application, we are building our own app packaging (e.g. the one in target/quarkus-app when using the default fast-jar packaging) but... we are also building a standard jar, which is 99% of the time completely useless.
Building this jar takes some time, especially when you have a large application.
It is quite inefficient compared to what we now do when packaging a fast-jar.
For instance, with the Quarkus application I currently benchmark (~10 000 classes), this is how the time is spent in a `mvn clean package`:
Aggregation by mojo 33s 671ms(100%)
org.apache.maven.plugins:maven-clean-plugin:3.2.0 (default-clean) 246ms(0%)
org.apache.maven.plugins:maven-resources-plugin:3.3.1 (default-resources) 43ms(0%)
io.quarkus:quarkus-maven-plugin:999-SNAPSHOT (default) 6s 653ms(19%)
org.apache.maven.plugins:maven-compiler-plugin:3.14.1-SNAPSHOT (default-compile) 5s 495ms(16%)
org.apache.maven.plugins:maven-resources-plugin:3.3.1 (default-testResources) 3ms(0%)
org.apache.maven.plugins:maven-compiler-plugin:3.14.1-SNAPSHOT (default-testCompile) 968ms(2%)
org.apache.maven.plugins:maven-surefire-plugin:3.5.2 (default-test) 41ms(0%)
org.apache.maven.plugins:maven-jar-plugin:3.4.1 (default-jar) 19s 872ms(59%)
Out of 33 seconds of builds, 19 seconds are for building this useless jar.
If I disable the maven-jar-plugin and the maven-install-plugin, it's now less than half the time:
Aggregation by mojo 14s 542ms(100%)
org.apache.maven.plugins:maven-clean-plugin:3.2.0 (default-clean) 245ms(1%)
org.apache.maven.plugins:maven-resources-plugin:3.3.1 (default-resources) 39ms(0%)
io.quarkus:quarkus-maven-plugin:999-SNAPSHOT (default) 7s 102ms(48%)
org.apache.maven.plugins:maven-compiler-plugin:3.14.1-SNAPSHOT (default-compile) 5s 718ms(39%)
org.apache.maven.plugins:maven-resources-plugin:3.3.1 (default-testResources) 3ms(0%)
org.apache.maven.plugins:maven-compiler-plugin:3.14.1-SNAPSHOT (default-testCompile) 1s 33ms(7%)
org.apache.maven.plugins:maven-surefire-plugin:3.5.2 (default-test) 45ms(0%)
While there might be cases where you actually want to build this jar and install it (or install the generated uberjar), I think we should disable these plugins by default in our application template and add comments in the pom.xml to clearly explain why you might want to enable them in some rare cases.
This makes quite a difference in your daily dev experience and I think it's worth the extra work in the corner cases.
In practice, we would add something like this to the generated template:
+ <!--
+ This section disables the build and installation of the default jar, which are in general not needed for a Quarkus application.
+ If you need to produce a standard jar for some reason, you can either remove this section.
+ -->
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.5.0</version>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>3.1.4</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <!-- End of section -->
Thoughts?
--
Guillaume