Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - Wrong folder structure

Tags:

maven

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

like image 993
user2649233 Avatar asked Apr 06 '26 06:04

user2649233


1 Answers

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.

like image 172
Little Santi Avatar answered Apr 08 '26 19:04

Little Santi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!