Otavio Rodolfo Piske created CAMEL-19504:
--------------------------------------------
Summary: camel-core: post-compile lifecycle phase leads to double
compilation
Key: CAMEL-19504
URL: https://issues.apache.org/jira/browse/CAMEL-19504
Project: Camel
Issue Type: Task
Components: camel-core-reifier, build system, camel-core
Reporter: Otavio Rodolfo Piske
Attachments: camel-core-model-twice.log
I discovered that our build seems to waste a lot of time recompiling code due
to some of the code generators generating the code in a post-compile Maven
lifecycle phase.
This seems to happen for a lot of modules, but below I describe the problem for
the camel-core-model.
Here's the problem:
1. The camel-core-model [depends on the
camel-package-maven-plugin|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/core/camel-core-model/pom.xml#L72-L88]
to generate the configurers (such as
[ServiceCallConfigurationConfigurer|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/core/camel-core-model/src/generated/java/org/apache/camel/model/cloud/ServiceCallConfigurationConfigurer.java],
[Resilience4jConfigurationDefinitionConfigurer|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/core/camel-core-model/src/generated/java/org/apache/camel/model/Resilience4jConfigurationDefinitionConfigurer.java],
etc).
2. The
[ConfigurerGeneratorMojo|https://github.com/apache/camel/blob/41e0df411bf80104f10929d8d80392564cbcaf72/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/GenerateConfigurerMojo.java#L32-L35]
uses the PROCESS_CLASSES lifecycle phase as the default.
3. As per [Maven
documentation|https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference],
the process class phase happens after the compile.
4. As a result, the code is generated after the first compilation, which leads
to warning "[INFO] Changes detected - recompiling the module" and a
recompilation of the module.
5. In some cases, this leads to a recompilation of the whole module, which can
increase the build time significantly for large modules.
See the attached log files for examples.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)