3

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

user2649233
  • 912
  • 4
  • 14
  • 28
  • Maybe this helps: http://stackoverflow.com/questions/11772969/package-presentation-in-java-ee-perspective-in-eclipse – ppasler Jan 30 '17 at 08:22
  • @ppasler I already have the project presentation as flat. I have other maven projects in this same workspace whose structure is correct. I am facing issue only with this specific project. – user2649233 Jan 30 '17 at 08:35
  • It can be that you created one physical "main.java.com.vod.main" directory, instead of 5 (main/java/com/vod/main). And you should try to keep package names all lowercase. – Tome Jan 30 '17 at 09:02
  • @Tome please refer to edited question. All of them is not created as a single dirs – user2649233 Jan 30 '17 at 09:51
  • Are you using m2e in Eclipse? If not install it and use it to import Maven projects in Eclipse... – khmarbaise Jan 30 '17 at 11:27

1 Answers1

4

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.

Little Santi
  • 8,563
  • 2
  • 18
  • 46
  • You should not checkin metadata files of Eclipse into Git cause by using the correct import functionality related to Eclipse M2E those files will automatically created....And then they are correct. – khmarbaise Jan 30 '17 at 11:26
  • @khmarbaise I have learnt that, in practice, you save much trouble by publishing the metadata files in the control version system. What's wrong with it? – Little Santi Jan 30 '17 at 11:34