isahilarora
isahilarora

Reputation: 115

Maven package structure changed after build Eclipse

I created a Maven project in Eclipse. Initially my package structure was like

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

When I build the project successfully and got war deployed in tomcat, My project structure changed to

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

This is generating errors in Java class files in packages import declarations. I want to restore my original project structure. I have m2eclipse plugin installed in Eclipse.

I also tried Maven>Update Project.. (I read somewhere on Stack Overflow that it will restore the original structure) but it is generating 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 how I can restore my project structure back.

Upvotes: 9

Views: 2977

Answers (2)

Claude
Claude

Reputation: 1784

The following helped in my context:

  • Eclipse Luna (4.4.2) with Maven embedded
  • Multi module project where folder structure is
    • parent P
      • module A
      • module B
  • P is a normal Eclipse project while A and B are Maven projects
  • P is a closed, A and B are opened
  • the error happened in B with message Resource /P/B/.settings not available

After opening P again the error disappears and Project>Maven>Update Project... works fine.

Upvotes: 4

LONGHORN007
LONGHORN007

Reputation: 546

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

Steps 1.Go to src folder & Right Click 2.New->Others->Source Fokder 3.Then make the folder structure as /main/java & /main/resources 4.Then add the packages.

Upvotes: 1

Related Questions