Maven Package Structure Changed After Eclipse Build

I created a Maven project in Eclipse. Initially, my package structure was similar to

-src/main/java ---com.package1 ---com.package2 -src/main/resources 

When I successfully built the project and launched the war in tomcat, my project structure changed to

 -src.main.java.com.package1 -src.main.java.com.package2 -src.main.resources 

This creates errors in Java class files in package import declarations. I want to restore the original structure of the project. I have a m2eclipse plugin installed in Eclipse.

I also tried Maven> Update Project .. (I read somewhere in Stack Overflow that it will restore the original structure), but it generates the following error

 Failed while installing JAX-RS (REST Web Services) 1.1. org.osgi.service.prefs.BackingStoreException: Resource /Workspace/ProjectName/.settings' does not exist. 

Please help me restore the project structure back.

+8
java eclipse maven tomcat m2e
source share
2 answers

In my context, the following helped:

  • Eclipse Luna (4.4.2) with built-in Maven
  • A multi-module project in which a folder structure
    • parent P
      • module A
      • module B
  • P is a normal Eclipse project, and A and B are Maven projects
  • P closed, A and B open
  • an error occurred in B with the message Resource /P/B/.settings not available

After reopening P, the error disappears and Project>Maven>Update Project... works fine.

+3
source share

It seems you have created the source folder src / main / java and src / main / resources. Just change them to the source folder. He will work.

Steps 1. Go to the src folder and right-click 2. New-> Others-> Source Fokker 3. Then create the folder structure as / main / java and / main / resources 4. Then add the packages.

0
source share

All Articles