camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Collovati (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-10711) Consider using add[Test]CompileSourceRoot in api component maven plugin
Date Wed, 18 Jan 2017 21:27:26 GMT

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

Marco Collovati commented on CAMEL-10711:
-----------------------------------------

A question about the all-it integration test: the plugin is bound only to *generate-test-sources*
phase, so, in this case, the sources added with *addCompileSourceRoot* will not be compiled.

Is this a real usage scenario? Should we somehow check if sources in *generatedSrcDir* are
already compiled and otherwise add them with *addTestCompileSourceRoot* (as done with build-helper-maven-plugin)
?

> Consider using add[Test]CompileSourceRoot in api component maven plugin
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-10711
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10711
>             Project: Camel
>          Issue Type: New Feature
>          Components: tooling
>            Reporter: Marco Collovati
>            Priority: Minor
>             Fix For: Future
>
>
> When using camel-api-component-maven-plugin we must also add
> build-helper-maven-plugin to ensure that generated sources are added
> to the project for compilation.
> To avoid this configuration step it is possible to add the source path
> directly from the plugin by calling *MavenProject.addCompileSourceRoot*
> and *MavenProject.addTestCompileSourceRoot*.
> {code:java}
> project.addCompileSourceRoot(this.generatedSrcDir.getAbsolutePath());
> project.addTestCompileSourceRoot(this.generatedTestDir.getAbsolutePath());
> {code}
> This can maybe be done at the end of the execute method of ApiComponentGeneratorMojo
and AbstractApiMethodGeneratorMojo.
> It could also be a nice idea to add  boolean properties  in AbstractGeneratorMojo in
order to enable or disable the automatic addition of the source.
> {code:java}
> @Parameter(defaultValue = "true", property = PREFIX + "addCompileSourceRoot", required
= false)
> private boolean addCompileSourceRoot = true;
> @Parameter(defaultValue = "true", property = PREFIX + "addTestCompileSourceRoot", required
= false)
> private boolean addTestCompileSourceRoot = true;
> {code}
> {code:java}
> if (this.addCompileSourceRoot) {
>   project.addCompileSourceRoot(this.generatedSrcDir.getAbsolutePath());
> }
> if (this.addTestCompileSourceRoot) {
>  project.addTestCompileSourceRoot(this.generatedTestDir.getAbsolutePath());
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message