You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Minh Tran <mi...@gmail.com> on 2022/03/26 12:17:55 UTC
camel-component-maven-plugin not hooked to the correct maven phase
Hi
According to the docs, this plugin is meant to execute on
the process-classes phase. However this phase executes after the compile
phase so the autogenerated class never gets compiled.
If you subsequently run the maven execution again, the compiler picks it up
the second time around. Unit tests that rely on the generated class will
always fail the first time and pass on the second. Compounding the issue is
that the default output directory is src/generated which does not get
cleaned up when running "mvn clean". If you add this directory to be
cleaned up by maven-clean-plugin then you can consistently reproduce this
bug. IMO, camel should be defaulting to generating sources in the target
directory so it would get cleaned up by default.
I have attempted to change the phase that camel-component-maven-plugin gets
executed but no classes seem to get generated at all. I tried
generate-sources and compile phase, neither worked.
This bug pretty much prevents any correct builds happening in the cloud
(like Bitbucket/Azure pipelines) as everything starts from scratch. If you
have unit tests that rely on it, the build will fail. If you don't have
unit tests, then you end up with a jar missing the autogenerated class in
it.
I am using Camel 3.15.0 and JDK 11
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah lets add this to the docs
https://issues.apache.org/jira/browse/CAMEL-17903
On Tue, Mar 29, 2022 at 11:18 AM Minh Tran <mi...@gmail.com> wrote:
>
> This workaround does the job. Thank you Claus.
>
> On Mon, 28 Mar 2022 at 23:16, Claus Ibsen <cl...@gmail.com> wrote:
>
> > It is a plugin to assist when building custom camel components, not to
> > use for end user applications.
> >
> > It is currently two-step as I said. Its not an easy fix.
> >
> > In the camel project we have a re-compile step
> >
> > <plugin>
> > <artifactId>maven-compiler-plugin</artifactId>
> > <executions>
> > <execution>
> > <id>recompile</id>
> > <goals>
> > <goal>compile</goal>
> > </goals>
> > <phase>process-classes</phase>
> > </execution>
> > </executions>
> > </plugin>
> >
> >
> > On Mon, Mar 28, 2022 at 1:39 PM Minh Tran <mi...@gmail.com> wrote:
> > >
> > > Are you suggesting we should really be executing the build like this?
> > >
> > > mvn clean process-classes test
> > >
> > > It works I guess but highly unconventional compared to other maven code
> > > generation plugins. It could also potentially be a big overhead as you're
> > > running the all the phases prior to process-classes twice.
> > >
> > > Wouldn't the simplest solution be to fix the plugin to allow generating
> > the
> > > source during the generate-sources phase?
> > >
> > > On Mon, 28 Mar 2022 at 21:42, Claus Ibsen <cl...@gmail.com> wrote:
> > >
> > > > Yes it is.
> > > >
> > > > You need to run the camel plugin in its own maven execution first so
> > > > the source is generated prior to running maven again to test or
> > > > compile or whatever.
> > > > You cannot run this in a single maven command from clean.
> > > >
> > > >
> > > > On Mon, Mar 28, 2022 at 12:18 PM Minh Tran <mi...@gmail.com>
> > wrote:
> > > > >
> > > > > Hi
> > > > >
> > > > > This is not a chicken and egg problem. I've recreated a basic project
> > > > > illustrating the problem
> > > > >
> > > > > git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
> > > > >
> > > > > mvn clean test. -> will always fail. I've ensured clean will always
> > > > remove
> > > > > the autogenerated classes
> > > > > mvn test -> second attempt without the clean will pass
> > > > >
> > > > > On Mon, 28 Mar 2022 at 19:32, Claus Ibsen <cl...@gmail.com>
> > wrote:
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > Its a chicken and egg situation. Therefore its best to use the
> > plugin
> > > > > > to generate the source code ahead of time, eg in src/generated or
> > > > > > directly into the source folder - as shown in the doc page.
> > > > > >
> > > > > > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <minh.tran.25@gmail.com
> > >
> > > > wrote:
> > > > > > >
> > > > > > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <claus.ibsen@gmail.com
> > >
> > > > wrote:
> > > > > > >
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > The docs tells you where it outputs and how you can add
> > plugins to
> > > > > > > > include the src/generated folder
> > > > > > > >
> > > > > >
> > > >
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > > > > > >
> > > > > > >
> > > > > > > Yes you can change the defaults but the problem is that the
> > current
> > > > > > > defaults help to hide the bug in the plugin.
> > > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > You can also set which phase to execute the plugin
> > > > > > > >
> > > > > > >
> > > > > > > I tried both generated-sources and compile phase.
> > > > > > > - generated-sources didn't generate anything.
> > > > > > > - compile did generate the code but it executes after the
> > compiler
> > > > runs
> > > > > > so
> > > > > > > it never gets a chance to compile it. I tried moving the
> > > > > > > camel-component-maven-plugin to appear before the
> > > > maven-compiler-plugin
> > > > > > in
> > > > > > > the pom.xml but this seems to have no effect in the order of
> > > > execution. I
> > > > > > > am using maven 3.6.0
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Claus Ibsen
> > > > > > -----------------
> > > > > > http://davsclaus.com @davsclaus
> > > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > http://davsclaus.com @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Minh Tran <mi...@gmail.com>.
This workaround does the job. Thank you Claus.
On Mon, 28 Mar 2022 at 23:16, Claus Ibsen <cl...@gmail.com> wrote:
> It is a plugin to assist when building custom camel components, not to
> use for end user applications.
>
> It is currently two-step as I said. Its not an easy fix.
>
> In the camel project we have a re-compile step
>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <executions>
> <execution>
> <id>recompile</id>
> <goals>
> <goal>compile</goal>
> </goals>
> <phase>process-classes</phase>
> </execution>
> </executions>
> </plugin>
>
>
> On Mon, Mar 28, 2022 at 1:39 PM Minh Tran <mi...@gmail.com> wrote:
> >
> > Are you suggesting we should really be executing the build like this?
> >
> > mvn clean process-classes test
> >
> > It works I guess but highly unconventional compared to other maven code
> > generation plugins. It could also potentially be a big overhead as you're
> > running the all the phases prior to process-classes twice.
> >
> > Wouldn't the simplest solution be to fix the plugin to allow generating
> the
> > source during the generate-sources phase?
> >
> > On Mon, 28 Mar 2022 at 21:42, Claus Ibsen <cl...@gmail.com> wrote:
> >
> > > Yes it is.
> > >
> > > You need to run the camel plugin in its own maven execution first so
> > > the source is generated prior to running maven again to test or
> > > compile or whatever.
> > > You cannot run this in a single maven command from clean.
> > >
> > >
> > > On Mon, Mar 28, 2022 at 12:18 PM Minh Tran <mi...@gmail.com>
> wrote:
> > > >
> > > > Hi
> > > >
> > > > This is not a chicken and egg problem. I've recreated a basic project
> > > > illustrating the problem
> > > >
> > > > git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
> > > >
> > > > mvn clean test. -> will always fail. I've ensured clean will always
> > > remove
> > > > the autogenerated classes
> > > > mvn test -> second attempt without the clean will pass
> > > >
> > > > On Mon, 28 Mar 2022 at 19:32, Claus Ibsen <cl...@gmail.com>
> wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > Its a chicken and egg situation. Therefore its best to use the
> plugin
> > > > > to generate the source code ahead of time, eg in src/generated or
> > > > > directly into the source folder - as shown in the doc page.
> > > > >
> > > > > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <minh.tran.25@gmail.com
> >
> > > wrote:
> > > > > >
> > > > > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <claus.ibsen@gmail.com
> >
> > > wrote:
> > > > > >
> > > > > > > Hi
> > > > > > >
> > > > > > > The docs tells you where it outputs and how you can add
> plugins to
> > > > > > > include the src/generated folder
> > > > > > >
> > > > >
> > >
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > > > > >
> > > > > >
> > > > > > Yes you can change the defaults but the problem is that the
> current
> > > > > > defaults help to hide the bug in the plugin.
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > You can also set which phase to execute the plugin
> > > > > > >
> > > > > >
> > > > > > I tried both generated-sources and compile phase.
> > > > > > - generated-sources didn't generate anything.
> > > > > > - compile did generate the code but it executes after the
> compiler
> > > runs
> > > > > so
> > > > > > it never gets a chance to compile it. I tried moving the
> > > > > > camel-component-maven-plugin to appear before the
> > > maven-compiler-plugin
> > > > > in
> > > > > > the pom.xml but this seems to have no effect in the order of
> > > execution. I
> > > > > > am using maven 3.6.0
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Claus Ibsen
> > > > > -----------------
> > > > > http://davsclaus.com @davsclaus
> > > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > > >
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Claus Ibsen <cl...@gmail.com>.
It is a plugin to assist when building custom camel components, not to
use for end user applications.
It is currently two-step as I said. Its not an easy fix.
In the camel project we have a re-compile step
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>recompile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
On Mon, Mar 28, 2022 at 1:39 PM Minh Tran <mi...@gmail.com> wrote:
>
> Are you suggesting we should really be executing the build like this?
>
> mvn clean process-classes test
>
> It works I guess but highly unconventional compared to other maven code
> generation plugins. It could also potentially be a big overhead as you're
> running the all the phases prior to process-classes twice.
>
> Wouldn't the simplest solution be to fix the plugin to allow generating the
> source during the generate-sources phase?
>
> On Mon, 28 Mar 2022 at 21:42, Claus Ibsen <cl...@gmail.com> wrote:
>
> > Yes it is.
> >
> > You need to run the camel plugin in its own maven execution first so
> > the source is generated prior to running maven again to test or
> > compile or whatever.
> > You cannot run this in a single maven command from clean.
> >
> >
> > On Mon, Mar 28, 2022 at 12:18 PM Minh Tran <mi...@gmail.com> wrote:
> > >
> > > Hi
> > >
> > > This is not a chicken and egg problem. I've recreated a basic project
> > > illustrating the problem
> > >
> > > git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
> > >
> > > mvn clean test. -> will always fail. I've ensured clean will always
> > remove
> > > the autogenerated classes
> > > mvn test -> second attempt without the clean will pass
> > >
> > > On Mon, 28 Mar 2022 at 19:32, Claus Ibsen <cl...@gmail.com> wrote:
> > >
> > > > Hi
> > > >
> > > > Its a chicken and egg situation. Therefore its best to use the plugin
> > > > to generate the source code ahead of time, eg in src/generated or
> > > > directly into the source folder - as shown in the doc page.
> > > >
> > > > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <mi...@gmail.com>
> > wrote:
> > > > >
> > > > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <cl...@gmail.com>
> > wrote:
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > The docs tells you where it outputs and how you can add plugins to
> > > > > > include the src/generated folder
> > > > > >
> > > >
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > > > >
> > > > >
> > > > > Yes you can change the defaults but the problem is that the current
> > > > > defaults help to hide the bug in the plugin.
> > > > >
> > > > >
> > > > > >
> > > > > > You can also set which phase to execute the plugin
> > > > > >
> > > > >
> > > > > I tried both generated-sources and compile phase.
> > > > > - generated-sources didn't generate anything.
> > > > > - compile did generate the code but it executes after the compiler
> > runs
> > > > so
> > > > > it never gets a chance to compile it. I tried moving the
> > > > > camel-component-maven-plugin to appear before the
> > maven-compiler-plugin
> > > > in
> > > > > the pom.xml but this seems to have no effect in the order of
> > execution. I
> > > > > am using maven 3.6.0
> > > >
> > > >
> > > >
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > http://davsclaus.com @davsclaus
> > > > Camel in Action 2: https://www.manning.com/ibsen2
> > > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Minh Tran <mi...@gmail.com>.
Are you suggesting we should really be executing the build like this?
mvn clean process-classes test
It works I guess but highly unconventional compared to other maven code
generation plugins. It could also potentially be a big overhead as you're
running the all the phases prior to process-classes twice.
Wouldn't the simplest solution be to fix the plugin to allow generating the
source during the generate-sources phase?
On Mon, 28 Mar 2022 at 21:42, Claus Ibsen <cl...@gmail.com> wrote:
> Yes it is.
>
> You need to run the camel plugin in its own maven execution first so
> the source is generated prior to running maven again to test or
> compile or whatever.
> You cannot run this in a single maven command from clean.
>
>
> On Mon, Mar 28, 2022 at 12:18 PM Minh Tran <mi...@gmail.com> wrote:
> >
> > Hi
> >
> > This is not a chicken and egg problem. I've recreated a basic project
> > illustrating the problem
> >
> > git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
> >
> > mvn clean test. -> will always fail. I've ensured clean will always
> remove
> > the autogenerated classes
> > mvn test -> second attempt without the clean will pass
> >
> > On Mon, 28 Mar 2022 at 19:32, Claus Ibsen <cl...@gmail.com> wrote:
> >
> > > Hi
> > >
> > > Its a chicken and egg situation. Therefore its best to use the plugin
> > > to generate the source code ahead of time, eg in src/generated or
> > > directly into the source folder - as shown in the doc page.
> > >
> > > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <mi...@gmail.com>
> wrote:
> > > >
> > > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <cl...@gmail.com>
> wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > The docs tells you where it outputs and how you can add plugins to
> > > > > include the src/generated folder
> > > > >
> > >
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > > >
> > > >
> > > > Yes you can change the defaults but the problem is that the current
> > > > defaults help to hide the bug in the plugin.
> > > >
> > > >
> > > > >
> > > > > You can also set which phase to execute the plugin
> > > > >
> > > >
> > > > I tried both generated-sources and compile phase.
> > > > - generated-sources didn't generate anything.
> > > > - compile did generate the code but it executes after the compiler
> runs
> > > so
> > > > it never gets a chance to compile it. I tried moving the
> > > > camel-component-maven-plugin to appear before the
> maven-compiler-plugin
> > > in
> > > > the pom.xml but this seems to have no effect in the order of
> execution. I
> > > > am using maven 3.6.0
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Claus Ibsen <cl...@gmail.com>.
Yes it is.
You need to run the camel plugin in its own maven execution first so
the source is generated prior to running maven again to test or
compile or whatever.
You cannot run this in a single maven command from clean.
On Mon, Mar 28, 2022 at 12:18 PM Minh Tran <mi...@gmail.com> wrote:
>
> Hi
>
> This is not a chicken and egg problem. I've recreated a basic project
> illustrating the problem
>
> git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
>
> mvn clean test. -> will always fail. I've ensured clean will always remove
> the autogenerated classes
> mvn test -> second attempt without the clean will pass
>
> On Mon, 28 Mar 2022 at 19:32, Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > Its a chicken and egg situation. Therefore its best to use the plugin
> > to generate the source code ahead of time, eg in src/generated or
> > directly into the source folder - as shown in the doc page.
> >
> > On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <mi...@gmail.com> wrote:
> > >
> > > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <cl...@gmail.com> wrote:
> > >
> > > > Hi
> > > >
> > > > The docs tells you where it outputs and how you can add plugins to
> > > > include the src/generated folder
> > > >
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> > >
> > >
> > > Yes you can change the defaults but the problem is that the current
> > > defaults help to hide the bug in the plugin.
> > >
> > >
> > > >
> > > > You can also set which phase to execute the plugin
> > > >
> > >
> > > I tried both generated-sources and compile phase.
> > > - generated-sources didn't generate anything.
> > > - compile did generate the code but it executes after the compiler runs
> > so
> > > it never gets a chance to compile it. I tried moving the
> > > camel-component-maven-plugin to appear before the maven-compiler-plugin
> > in
> > > the pom.xml but this seems to have no effect in the order of execution. I
> > > am using maven 3.6.0
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Minh Tran <mi...@gmail.com>.
Hi
This is not a chicken and egg problem. I've recreated a basic project
illustrating the problem
git clone https://bitbucket.org/minh_tran__/camel_plugin_bug.git
mvn clean test. -> will always fail. I've ensured clean will always remove
the autogenerated classes
mvn test -> second attempt without the clean will pass
On Mon, 28 Mar 2022 at 19:32, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Its a chicken and egg situation. Therefore its best to use the plugin
> to generate the source code ahead of time, eg in src/generated or
> directly into the source folder - as shown in the doc page.
>
> On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <mi...@gmail.com> wrote:
> >
> > On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <cl...@gmail.com> wrote:
> >
> > > Hi
> > >
> > > The docs tells you where it outputs and how you can add plugins to
> > > include the src/generated folder
> > >
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
> >
> >
> > Yes you can change the defaults but the problem is that the current
> > defaults help to hide the bug in the plugin.
> >
> >
> > >
> > > You can also set which phase to execute the plugin
> > >
> >
> > I tried both generated-sources and compile phase.
> > - generated-sources didn't generate anything.
> > - compile did generate the code but it executes after the compiler runs
> so
> > it never gets a chance to compile it. I tried moving the
> > camel-component-maven-plugin to appear before the maven-compiler-plugin
> in
> > the pom.xml but this seems to have no effect in the order of execution. I
> > am using maven 3.6.0
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Its a chicken and egg situation. Therefore its best to use the plugin
to generate the source code ahead of time, eg in src/generated or
directly into the source folder - as shown in the doc page.
On Mon, Mar 28, 2022 at 10:24 AM Minh Tran <mi...@gmail.com> wrote:
>
> On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <cl...@gmail.com> wrote:
>
> > Hi
> >
> > The docs tells you where it outputs and how you can add plugins to
> > include the src/generated folder
> > https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
>
>
> Yes you can change the defaults but the problem is that the current
> defaults help to hide the bug in the plugin.
>
>
> >
> > You can also set which phase to execute the plugin
> >
>
> I tried both generated-sources and compile phase.
> - generated-sources didn't generate anything.
> - compile did generate the code but it executes after the compiler runs so
> it never gets a chance to compile it. I tried moving the
> camel-component-maven-plugin to appear before the maven-compiler-plugin in
> the pom.xml but this seems to have no effect in the order of execution. I
> am using maven 3.6.0
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Minh Tran <mi...@gmail.com>.
On Mon, 28 Mar 2022 at 18:14, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> The docs tells you where it outputs and how you can add plugins to
> include the src/generated folder
> https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
Yes you can change the defaults but the problem is that the current
defaults help to hide the bug in the plugin.
>
> You can also set which phase to execute the plugin
>
I tried both generated-sources and compile phase.
- generated-sources didn't generate anything.
- compile did generate the code but it executes after the compiler runs so
it never gets a chance to compile it. I tried moving the
camel-component-maven-plugin to appear before the maven-compiler-plugin in
the pom.xml but this seems to have no effect in the order of execution. I
am using maven 3.6.0
Re: camel-component-maven-plugin not hooked to the correct maven phase
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
The docs tells you where it outputs and how you can add plugins to
include the src/generated folder
https://camel.apache.org/manual/camel-component-maven-plugin.html#_generate
You can also set which phase to execute the plugin
On Sat, Mar 26, 2022 at 1:18 PM Minh Tran <mi...@gmail.com> wrote:
>
> Hi
>
> According to the docs, this plugin is meant to execute on
> the process-classes phase. However this phase executes after the compile
> phase so the autogenerated class never gets compiled.
>
> If you subsequently run the maven execution again, the compiler picks it up
> the second time around. Unit tests that rely on the generated class will
> always fail the first time and pass on the second. Compounding the issue is
> that the default output directory is src/generated which does not get
> cleaned up when running "mvn clean". If you add this directory to be
> cleaned up by maven-clean-plugin then you can consistently reproduce this
> bug. IMO, camel should be defaulting to generating sources in the target
> directory so it would get cleaned up by default.
>
> I have attempted to change the phase that camel-component-maven-plugin gets
> executed but no classes seem to get generated at all. I tried
> generate-sources and compile phase, neither worked.
>
> This bug pretty much prevents any correct builds happening in the cloud
> (like Bitbucket/Azure pipelines) as everything starts from scratch. If you
> have unit tests that rely on it, the build will fail. If you don't have
> unit tests, then you end up with a jar missing the autogenerated class in
> it.
>
> I am using Camel 3.15.0 and JDK 11
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2