如何配置IntelliJ IDEA和/或Maven自动添加使用jaxb2-maven-plugin生成的Java源代码的目录? [英] How to configure IntelliJ IDEA and/or Maven to automatically add directories with Java source code generated using jaxb2-maven-plugin?

查看:1621
本文介绍了如何配置IntelliJ IDEA和/或Maven自动添加使用jaxb2-maven-plugin生成的Java源代码的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的项目中,我们使用 jaxb2-maven-plugin 从XML Schema生成Java源代码,这导致我们的Maven模块需要额外的源代码目录(在我们的case target / generated / main / java )。到目前为止,我一直在使用Eclipse和 maven-eclipse-plugin 将所有项目导入Eclipse工作区。该插件(以某种方式)能够将生成的源代码的目录自动添加到Eclipse的.classpath文件中。

In our project we are using jaxb2-maven-plugin to generate Java source code from XML Schema, which causes that our Maven module requires additional source code directory (in our case target/generated/main/java). Up to date I've been using Eclipse and maven-eclipse-plugin to import all the projects into Eclipse workspace. The plugin is (somehow) able to add the directory with generated source code automatically to Eclipse' .classpath file.

最近我尝试切换到(玩?)IntelliJ IDEA 9(所以我是这个环境中的新手)并且我注意到在IDEA的导入过程中没有添加额外的源目录......

Recently I try to switch to (play with?) IntelliJ IDEA 9 (so I am a newbie in this environment) and I've noticed that additional source directory is not added during IDEA's importing process...

有没有办法我可以配置IDEA / Maven自动导入带有生成源代码的目录吗?

Is there any way I can configure IDEA/Maven to make importing directory with generated source code automatically?

推荐答案

Maven的约定是生成代码 target / generated-sources /< tool> ,例如 target / generated-sources / jaxb2

The convention with Maven is to generate code in target/generated-sources/<tool>, for example target/generated-sources/jaxb2

按照这个惯例,IDEA会将文件夹添加为源文件夹(参见 IDEA-53198

Follow this convention and IDEA will add the folder as source folder (see IDEA-53198).

这篇关于如何配置IntelliJ IDEA和/或Maven自动添加使用jaxb2-maven-plugin生成的Java源代码的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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