使用 build-helper-maven 附加源目录

Attach source directory with build-helper-maven

我试图在使用 build-helper-maven 插件时附加由 jaxb 或 cxf 生成的源目录。不幸的是,即使我在 mvn generate-sources 中取得了成功,我的 eclipse 也没有将目标目录添加为源文件夹。

<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>

日志:

    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ coucou-services ---
[INFO] Deleting D:[=11=]4_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:[=11=]4_Development\coucou\Workspace\coucou-bom\coucou-services\target\generated\cxf added.
[INFO] 
[INFO] -

你有什么想法吗?

此致

Eclipse 的 M2 插件将更好地解释 build 部分中的声明。试试这个:

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