为什么Maven生成的源无法得到编译?
问题内容:
我有一个在target/generated-sources/wrappers
目录下生成源的插件。它被连接到generate-
sources阶段,如下所示:
<plugin>
<groupId>mygroupid</groupId>
<artifactId>myartifactid</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>xml2java</goal>
</goals>
</execution>
</executions>
</plugin>
问题是,当我使用文件时mvn deploy
,.class
文件将不会放在罐子中。我在.java
那里看到所有文件,但没有.class
。
我阅读了有关此问题的所有问题,但不知道如何解决该问题。我正在使用Maven3.0.x。
问题答案:
build-helper插件确实解决了这个问题。感谢@Joe的评论。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/wrappers</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>