ber*_*ert 14 code-generation intellij-idea maven
我从wsdl文件生成Java源代码.这些源不受版本控制(但是wsdl是).我们在maven中使用cxf-codegen-plugin,并生成生成的类<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
.
这在maven中运行良好.
我必须将此目录定义为Intelij Idea中的附加源目录.(target
通常被排除在外).
但每次我将maven项目重新导入InteliJ Idea时(由于pom更改),我必须在Idea中手动编辑项目结构并重新定义添加源目录.
有没有什么方法可以在maven中定义这个aditional源目录,所以Idea在重新加载时选择它,或者告诉Idea不要忘记手动源directoy定义?
Cra*_*der 11
IntelliJ IDEA Maven FAQ,Generated Sources部分描述了这种情况:
重新导入项目时指定源根目录.
您可以选择以下选项之一:
自动检测这是默认选项.选择此选项时,IntelliJ IDEA会自动检测生成的源的位置.IntelliJ IDEA还会检测要标记为源根目录的目录.但是,IntelliJ IDEA仅在目标/生成源和目标/生成源/*目录中搜索生成的源.
target/generated-sources此选项使您可以手动将目录标记为源根目录.
"target/generated-sources"的子目录此选项使您可以手动将子目录标记为源根目录.
不检测此选项可让您跳过检测过程.
看看<add-source>
构建目标(请参阅此处的示例)
引用:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>add-wsdl-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src-generated/src</source>
</sources>
</configuration>
<!-- [...] -->
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18494 次 |
最近记录: |