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.
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.
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.
Related
In my eclipse maven project there is no java resources folder like this.
When I create my dynamic web application there is no java resources folder in it. I tick the Generate web.xml deployment descriptor at the end also but there is no Java resources folder. Can you resolve my problem?
This is my project explorer. Can you see there is no java resources folder.
Which eclipse version are you using? I am using the newest stable version and the tree node "java resources" does not appear. It might have been called like that in older eclipse versions but I am not sure. The important thing is though, that you should have a tree node for "src/main/resources" or at least a hierarchical structure like
src
main
resources
You can also compare your structure with a sample project which you can create from maven archetypes. Go to File > New > Project > Maven > Maven Project > Next > and select one of the sample archetypes like maven-archetype-webapp > enter an artifact name and finish. Now you can see how it should be displayed in eclipse correctly.
I have the below Web project which is working fine. I wanted to change the structure of the project into a maven project structure.
So, I modified the project to as shown below(I created a new folder called webapp under src/main and I moved the contents of the folder WebContent into webapp and I deleted WebContent folder) Now the application doesn't work although I deploy it in the Tomcat Server. What is wrong in the below project structure . Please help me out
EDIT: I wanted a maven project structure as shown below which is a standard maven project structure
If you are using eclipse (which it looks like you are), you can use the M2Eclipse plugin, which will provide a "convert to maven" utility. Simply right click the project and go to configure -> convert to Maven.
https://www.eclipse.org/m2e/
The structure you are looking for can be defined at the time of project creation in the source directory screen. If you have an existing project you will need to add a new source folder.
To do so,
Add the folders to your project.
Right click on folder > build path > use as source folder.
I'm using Eclipse and I have Maven project with jar and war modules. I exported it to my github acc. and when I import it from Git it runs correctly but something is not like i wanted to. In my Parent module i have all the files, but situation changes in my jars and war module.
For example in src folder i have two folders, java and webapp, in war called "psy-webapp" java is missing. I read something about it, and i must change the path to let maven see all folders/files right? I'm also sending link to github project and a screenshot to see what i mean.
Github:https://github.com/jakubjaroszek/ltc
screenshot
I imported a project from github into Eclipse (project A), using these steps: Importing a GitHub project into Eclipse
I have another app engine project I am building in Eclipse (project B). I would like to import a class from the project A to project B. I was trying to follow these steps: How can I refer to a class from another project in the same Workspace in Eclipse/Java
But when I go to project B's Java build path --> Projects --> Add, the select project window does not show the imported github project.
If I create another local Java project (project C), I can see project C as an option to add to project B's build path.
Make sure you are copied project A into your workspace while import into eclipse.
There is a check box option for copy project into workspace in eclipse import project.
First, You will have to fix the project A at eclipse before importing into the project B... By fixing, I mean setup the source paths of the project A (example, the folder src/com/google, should be a source folder at the project A configuration)... The Project A must compile (if the project A cannot be compiled by eclipse, I doubt that you will have success at importing it into project B)
Another strategy would be use the ant script of the project A and import, as java library, the artecfacts generated by those ANT files into the project B.
I am trying to build a spring-mvc project that has another project (core, as .jar) as dependency.
If I disable "Resolve dependencies from workspace projects" in eclipse, install the core into my maven repo and run it from eclipse, the application works!
What I want to do, is re enable "Resolve dependencies from workspace projects", but there is the problem: When I try to run the project on tomcat (after maven clean, project clean), I get a "FileNotFoundException". The file in question is under src/main/resources/META-INF/spring/applicationContext-core.xml
It seems, the File can not be found in the classpath.
I looked up the deployment location and found out, that everything of the core is under the following folders:
WEB-INF
classes
So the file I am missing can be found here:
/WEB-INF/classes/META-INF/spring/applicationContext-core.xml
But it schould be here:
/META-INF/spring/applicationContext-core.xml
Why is the structure of my core dependency so messed up when I enable the workspace resolution and how can I fix this?
I am using eclipse mars with m2e..
Thanks for any help.
Edit:
Project structure (core) looks like this:
project structure