eclipse 删除项目的Maven性质后无法删除目标目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10478862/
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 18:08:58  来源:igfitidea点击:

Cannot delete target directory after removing Maven nature of project

javaeclipsemaven

提问by Michael

I decided not to use maven in my project. So, I right-clicked it in Eclipse and then "Remove maven nature". Everything seems to be ok, but I cannot remove the target directory. If I delete it from within Eclipse it's just created again, if I delete it from Explorer the result is the same, as soon as I clean my project from Eclipse it's just created again.

我决定不在我的项目中使用 maven。所以,我在 Eclipse 中右键单击它,然后“删除 maven 自然”。一切似乎都没问题,但我无法删除目标目录。如果我从 Eclipse 中删除它,它只是再次创建,如果我从资源管理器中删除它,结果是一样的,只要我从 Eclipse 中清除我的项目,它就会再次创建。

Where am I wrong?

我哪里错了?

Thanks in advance.

提前致谢。

回答by Bitmap

To disable & remove Maven targetdirectory

禁用和删除 Maven目标目录

  1. Right click on the project -select Maven->Disable Dependency Management.
  2. Right click on project - select Build Path-> Configure Build Path -> Source Tab. Untick "Allow output folder for source folders"
  3. Now type "Your Project Name"/bin eg. TestProject/bin, in the Default Output Folderfield to point to default.
  4. Now click ok and delete the target directory.
  1. 右键单击项目-选择 Maven->Disable Dependency Management.
  2. 右键单击项目 - 选择Build Path-> Configure Build Path -> Source Tab。取消勾选“允许源文件夹的输出文件夹
  3. 现在输入“您的项目名称”/bin 例如。TestProject/bin,在默认输出文件夹字段中指向默认值。
  4. 现在单击确定并删除目标目录。

回答by fywe

Try this: Right-click on project folder -> Properties -> Java Build Path -> Source Change folder in 'Default output folder:' section to point new location.

试试这个:右键单击项目文件夹 -> 属性 -> Java 构建路径 -> '默认输出文件夹:'部分中的源更改文件夹以指向新位置。

回答by Micha? Kalinowski

target/classesdirectory is just as good as any one else. Since m2e switched this, it's Maven standard output directory, not related or handled by m2e anymore. If you want, you can set own output directory by project's Properties -> Java Build Path -> Source -> Default output folder, for example to bindirectory which is Eclipse' default.

target/classes目录和其他目录一样好。由于 m2e 切换了这个,它是 Maven 标准输出目录,不再与 m2e 相关或处理。如果需要,您可以通过项目的 设置自己的输出目录Properties -> Java Build Path -> Source -> Default output folder,例如设置bin为 Eclipse 的默认目录。

回答by Vikram P

Right click on you project. Go to Build Path--> Configure Build Path Uncheck Maven Dependencies, this made my target folder to work fine.

右键单击您的项目。转到 Build Path--> Configure Build Path 取消选中 Maven Dependencies,这使我的目标文件夹可以正常工作。