You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Otavio Rodolfo Piske (Jira)" <ji...@apache.org> on 2023/06/26 17:01:00 UTC

[jira] [Commented] (CAMEL-19504) camel-core: post-compile lifecycle phase leads to double compilation

    [ https://issues.apache.org/jira/browse/CAMEL-19504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737272#comment-17737272 ] 

Otavio Rodolfo Piske commented on CAMEL-19504:
----------------------------------------------

Looking at the build log it seems that a lot of the code is compiled twice:

 
{code:java}
gzcat double-compilation.txt.gz| grep -A1  "(recompile)" | grep -i changes | wc -l
408{code}

> 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, camel-core, camel-core-reifier
>            Reporter: Otavio Rodolfo Piske
>            Priority: Major
>         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)