Eclipse m2e "Maven Project Update" adds unnecessary bin directory

I meet the strange behavior of m2e on an eclipse:

  • Clone project from git remote repository
  • The dir structure shown in the explorer project does not have maven natures, only pom.xml in the root and packages. No "JRE System Library", no "Maven dependencies". No "src / main / java", only "my.packages.1", "my.packages.2"
  • I am updating a project using maven-> Update Maven Project. Everything is well displayed, except for the one created bin directory, and the contents of bin dir are the same as the contents I wout from git.

Example: before updating the maven project:

.settings/ src/ pom.xml .gitignore 

after the update maven project:

 .settings/ src/ pom.xml .gitignore bin/ <------ this dir appears after update maven project bin/.settings/ <----------- contents the same as outside dir bin/src bin/.gitignore bin/pom.xml 

How to avoid this strange behavior?

+6
source share
2 answers

It seems that before executing the β€œupgrade project”, the bin directory was configured as the output directory. Output directories are hidden by default in Eclipse (at least in Package Explorer and Project Explorer). When you configured the project as a Maven project, the output directory was changed to target/classes . Your bin folder is now another folder that is no longer hidden.
Since you no longer need this, you can safely remove it.

+5
source

This happened to me because I excluded .classpath from the repo in .gitignore . I initially thought that there might be some conflicts between windows and Linux developers, but I was wrong, the .classpath should be identical.

If you do not have .classpath , when cloning, java-builder starts and parses things before creating maven, creating a clean .classpath .

Finish, commit and click .classpath and this will not happen again.

0
source

All Articles