我有一个更大的 Maven (3.0.4) 项目,其中包含生成 jaxb、javaws 等代码的模块。
我遇到的问题是,导入项目后,生成的源路径没有添加为 Eclipse 中的源文件夹。目前我需要手动添加文件夹 (target/generated-sources/jaxb) 才能使其在 Eclipse 中工作。
在旧版本的 m2e 中,存在一个控制导入期间运行的阶段的配置。
有人有必须改变的想法吗?
更新 我已经测试过通过 build-helper-maven-plugin 添加源文件夹
<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>target/generated-sources/jaxb/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
但这也不能解决问题。
最佳答案
您需要 m2eclipse-buildhelper 插件来让 m2e 知道如何添加新的源文件夹。 如果版本来自
Window > Preferences > Maven > Discovery > Open catalog...
无法安装,请尝试使用此 p2 更新站点来安装它:
关于Eclipse 3.7(indigo SR2)m2e(1.1)导入Maven不会添加生成源的源文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11409757/