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

ASF GitHub Bot commented on CAMEL-10711:
----------------------------------------

GitHub user mcollovati opened a pull request:

    https://github.com/apache/camel/pull/1418

    CAMEL-10711: Added automatic source roots addition in api maven plugin

    A property has been added: **addCompileSourceRoots** to automatically make 
generated source directory available in compilation phases.
    Available values are:
    
    * **source**: adds both _generatedSrcDir_ and _generatedTestDir_ as compile 
source roots
    * **test**: adds both _generatedSrcDir_ and _generatedTestDir_ as test 
compile source roots
    * **all**: adds _generatedSrcDir_ to compile source roots and 
_generatedTestDir_ as test compile source roots
    * **none**: do not add generated directories at all
    
    The default value is **all**.
    
    The integration test *all-it* has been modified to remove 
*build-helper-maven-plugin* 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mcollovati/camel 
CAMEL-10711/api-maven-plugin-compile-roots

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/1418.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1418
    
----
commit 72b137c100e99f9066bc1869d53269d0f12f9640
Author: Marco Collovati <(none)>
Date:   2017-01-22T16:19:57Z

    CAMEL-10711: Added automatic source roots addition in api 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)

Reply via email to