Плагин Maven build-helper, не включающий исходники в многомодульный проект
Я генерирую артефакты веб-сервиса с помощью cxf-xjc и пытаюсь добавить их в исходный код с помощью плагина build-helper. Это работало правильно, когда оно использовалось в одном проекте Maven, но теперь, когда я перешел в многомодульный проект, сгенерированные классы не включаются в качестве источника.
Классы генерируются правильно, и плагин build-helper выполняется после генерации классов. Вывод для build-helper показывает правильный путь к исходному каталогу, где расположены классы, и показывает "добавлено".
pom.xml
<!-- CXF -->
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<id>generate-xsd-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<sourceRoot>${basedir}/target/generated-sources/java</sourceRoot>
<xsdOptions>
<xsdOption>
<!-- <bindingFile>src/main/resources/request.xjb</bindingFile> -->
<xsd>src/main/resources/request.xsd</xsd>
<packagename>${services.package}.package.request</packagename>
</xsdOption>
<xsdOption>
<!-- <bindingFile>src/main/resources/response.xjb</bindingFile> -->
<xsd>src/main/resources/response.xsd</xsd>
<packagename>${services.package}.package.response</packagename>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
<!-- Move generated to source -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Консоль Snip
[INFO] --- **cxf-xjc-plugin:2.3.0:xsdtojava (generate-xsd-sources) @ aggregation-jaxrs-api** ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ aggregation-jaxrs-api ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ aggregation-jaxrs-api ---
[INFO] Compiling 55 source files to C:\workspace\aggregation-parent\aggregation-jaxrs-api\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ aggregation-jaxrs-api ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ aggregation-jaxrs-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ aggregation-jaxrs-api ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ aggregation-jaxrs-api ---
[INFO] Building jar: C:\workspace\aggregation-parent\aggregation-jaxrs-api\target\aggregation-jaxrs-api-1.0-SNAPSHOT.jar
[INFO]
**[INFO] --- build-helper-maven-plugin:1.12:add-source (add-source) @ aggregation-jaxrs-api ---
[INFO] Source directory: C:\workspace\aggregation-parent\aggregation-jaxrs-api\target\generated-sources\java added.**
Эта конфигурация работала нормально до того, как я переместил ее в модуль. Я перешел на фазу сборки-помощника между генерацией-источником и фазой-процессом без удачи. Я использую Spring Tool Suite 3.8, который основан на Eclipse Neon 4.6.1.
Спасибо
1 ответ
Я решил проблему, переместив папки проекта в мое рабочее пространство Eclipse. Они были расположены за пределами рабочей области и по какой-то причине перенесли проект в рабочую область и повторно импортировали его, что исправило ситуацию.