【发布时间】:2020-04-07 08:21:39
【问题描述】:
我有一个 maven 项目,它使用 exec-maven-plugin 将 java 类生成到目标/生成源中。 在 mvn clean install 期间永远不会编译下面生成的 java 类。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>prepare-package</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/foldername</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>add-sources</id>
<goals>
<goal>java</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<mainClass>mainclass</mainClass>
</configuration>
</execution>
</executions>
</plugin>
我必须为此使用 MOJO 吗?
【问题讨论】:
-
@Daniele maven-source-plugin 与此无关。您应该使用mojohaus.org/build-helper-maven-plugin 并将源代码添加到编译区域...
-
@khmarbaise 感谢您指出 out-user2916626 您可以分享 maven 项目吗?您应该为 build-helper-maven-plugin 添加一些配置,以将生成的源文件夹添加到正在编译的集合中
标签: java maven maven-plugin