Attach source directory with build-helper-maven

1.2k views Asked by At

I tried to attach a source directory generated by jaxb or cxf in using the build-helper-maven plugin. Unfortunately, even though I got a success in the mvn generate-sources, my eclipse didn't add the target directory as a source folder.

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${project.build.directory}/generated/cxf</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Log :

    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ coucou-services ---
[INFO] Deleting D:\004_Development\coucou\Workspace\coucou-bom\coucou-services\target
[INFO] 
[INFO] --- cxf-codegen-plugin:2.4.6:wsdl2java (generate-sources) @ coucou-services ---
[INFO] 
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (add-source) @ coucou-services ---
[INFO] Source directory: D:\004_Development\coucou\Workspace\coucou-bom\coucou-services\target\generated\cxf added.
[INFO] 
[INFO] -

Do you have any idea ?

Best regards

1

There are 1 answers

0
Little Santi On BEST ANSWER

Eclipse's M2 plugin will interpret better the declarations within the build section. Try this:

<build>
    <sourceDirectory>${project.build.directory}/generated/cxf</sourceDirectory>
</build>