user2649233
user2649233

Reputation: 912

Maven - Wrong folder structure

I have checked in one of my projects to GIT repo. When i cloned it from GIT, imported the project to eclipse and converted the project to Maven Project, the folder structure of maven seems to be a bit different

enter image description here

This should have been src/main/java, src/test/java, src/test/respurces folder structures and com.vod... as package.

I have tried maven>update project, project>clean, maven>clean, eclipse::clean, eclipse::eclipse. But this project structure does not seem to go off.

Any possible solutions for this please?

After importing the project as eclipse general project, below is the structure.

enter image description here

Upvotes: 3

Views: 3687

Answers (1)

Little Santi
Little Santi

Reputation: 8783

This is a typical problem due to the lack of Eclipse metadata files in the GIT repository.

How to solve it:

Open the project's contextual menu > Java Build Path > Configure Build Path > Source. Drop off folder src and set as folder sources just these:

  • src\main\java
  • src\main\resources
  • src\test\java
  • src\test\resources

This will save some metadata to the .classpath file.

Also, you should ensure that this was set as a Maven project: Open the project's contextual menu > Configure. If there is the Convert to Maven command, execute it (if not, it is already a Maven project). This might save some metadata to the .project file.

Then, be sure to check in the Eclipse metadata files (.classpath, .project and .settings folder) to GIT. And, in order for this project can be safely shared to other developers, be sure not to enter absolute paths in the java build path, nor other system-dependant constraints.

Upvotes: 4

Related Questions