[ 
https://issues.apache.org/jira/browse/CAMEL-19504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-19504.
---------------------------------
    Resolution: Fixed

maven has build cache so its not recompiled anymore

 

[INFO] --- compiler:3.14.1:compile (recompile) @ camel-api ---
[INFO] Loaded from the build cache, saving 0.288s

> 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: build system, came-core, camel-core
>            Reporter: Otavio Rodolfo Piske
>            Priority: Major
>              Labels: help-wanted
>         Attachments: camel-core-model-twice.log, double-compilation.txt.gz
>
>
> 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)

Reply via email to