eclipse 在eclipse中使用maven项目时,在项目导入时自动生成.factorypath

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42949198/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:23:42  来源:igfitidea点击:

Automatically generate .factorypath on project import when using maven project in eclipse

eclipsemavenm2eclipseannotation-processing

提问by Dag

The .factorypathfile is a generated file, which eclipse requires for annotation-processing. The m2eclipse plugin does generate this file when using "Update Maven Project" (Alt+F5) and checking "Update project configuration from pom.xml".

.factorypath文件是生成的文件,eclipse 需要该文件进行注释处理。当使用“更新 Maven 项目”(Alt+F5) 并检查“从 pom.xml 更新项目配置”时,m2eclipse 插件会生成此文件。

However, I don't want to check this file into version control. But if not, and someone from the team does a fresh checkout, and imports the project in eclipse, the .factorypathdoes not get generated until the "Update Maven Project" is performed manually. I don't want this manual step when a project gets imported, this has to happen automatically. Is there an option, that a project has to be updated upon import?

但是,我不想将此文件签入版本控制。但是,如果没有,并且团队中的某个人进行了新的结帐,并在 eclipse 中导入了项目,.factorypath则在手动执行“更新 Maven 项目”之前不会生成该项目。我不希望在导入项目时执行此手动步骤,这必须自动发生。有没有一个选项,项目必须在导入时更新?

回答by Kevin Javia

Assuming your real issue is

假设你真正的问题是

I don't want to check this file into version control.

我不想将此文件签入版本控制。

Though you have not specified which version control you are using but if you are a GIT or SVN user, you need to add files/directories pattern in GIT ignore file or SVN ignore properties.

虽然您没有指定您使用的版本控制,但如果您是 GIT 或 SVN 用户,则需要在 GIT 忽略文件或 SVN 忽略属性中添加文件/目录模式。

Read more on GIT Ignoreor SVN Ignore.

阅读更多关于GIT IgnoreSVN Ignore 的信息

回答by Javier Aviles

Since this is an IDE related question, and you seem to be using eclipse:

由于这是一个与 IDE 相关的问题,而且您似乎正在使用 eclipse:

window > preferences > maven > automatically update Maven projects configuration

窗口 > 首选项 > maven > 自动更新 Maven 项目配置

This will make it for you on project import so you would not need that manual step anymore.

这将使您在项目导入时使用它,因此您不再需要该手动步骤。