在maven中定义其他源目录 [英] define additional source directory in maven

查看:447
本文介绍了在maven中定义其他源目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从wsdl文件生成Java源代码。这些源不受版本控制(但wsdl是)。我们在maven中使用cxf-codegen-plugin,生成的类在< sourceRoot> $ {project.build.directory} / generated / cxf< / sourceRoot> 中生成。

I generate Java sources from a wsdl file. These sources are not under version control (but the wsdl is). We use the cxf-codegen-plugin in maven and the generated classes are generated in <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>.

这在maven中运作良好。

This works all fine in maven.

我必须将此目录定义为Intelij Idea中的附加源目录。 (目标正常排除)。

I have to define this directory as addition source directory in Intelij Idea. (targetis normaly excluded).

但每次我将maven项目重新导入InteliJ Idea(到期)我需要在Idea中手动编辑项目结构并重新定义添加源目录。

But every time I re-import the maven project into InteliJ Idea (due to pom changes), I have to manually edit the project structure in Idea and redefine the addition source directory.

我有什么方法可以定义这个aditional源目录maven,所以Idea在重新加载时选择它,或者告诉Idea不要忘记手动源的directoy定义?

Is there any way I can either define this aditional source directory in maven, so Idea picks it up on reload, or tell Idea not to forget the manual source directoy definition?

推荐答案

这个案例是 IntelliJ IDEA Maven常见问题解答生成的来源 section:

This case is described in the IntelliJ IDEA Maven FAQ, Generated Sources section:


重新导入项目时指定源根目录。

您可以选择以下选项之一:

Specify the directory of your source root when you reimport a project.
You can select one of the following options:


  • 自动检测这是默认选项。选择此选项时,IntelliJ IDEA会自动检测生成的源的位置。 IntelliJ IDEA还会检测要标记为源根目录的目录。但是,IntelliJ IDEA仅在目标/生成源和目标/生成源/ *目录中搜索生成的源。

  • Detect automatically This is a default option. When you select this option, IntelliJ IDEA automatically detects the location of the generated sources. IntelliJ IDEA also detects which directory to mark as a source root. However, IntelliJ IDEA searches for the generated sources only in target/generated-sources and target/generated-sources/* directories.

target / generated-sources选项使您可以手动将目录标记为源根。

target/generated-sources This option enables you to mark the directory as source root manually.

target / generated-sources的子目录此选项使您可以将子目录标记为源root手动。

subdirectories of "target/generated-sources" This option enables you to mark a subdirectory as a source root manually.

不检测此选项可让您跳过检测过程。

Don't detect This option lets you skip the detection process.

这篇关于在maven中定义其他源目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆