gudii9
asked on
maven structure
Hi,
I was going through below maven example
http://www.srccodes.com/p/article/24/spring-3-mvc-framework-based-hello-world-web-application-example-using-maven-eclipse-ide-and-tomcat-server
as given in the picture of the project in the link the maven structure seems very connfusing to me compared to conventional web application structure.
why there
SpringSecurityHelloWorld/s rc/main/re sources
which has again packages to contain .java files
Again why there is other src under which main--->web-app --->web-ing--->pages---.js p files
can you advise on advantages, disadvanges, practical uses of this structure.
Please advise. Any ideas, resources, sample code highly appreciated. thanks in advance
I was going through below maven example
http://www.srccodes.com/p/article/24/spring-3-mvc-framework-based-hello-world-web-application-example-using-maven-eclipse-ide-and-tomcat-server
as given in the picture of the project in the link the maven structure seems very connfusing to me compared to conventional web application structure.
why there
SpringSecurityHelloWorld/s
which has again packages to contain .java files
Again why there is other src under which main--->web-app --->web-ing--->pages---.js
can you advise on advantages, disadvanges, practical uses of this structure.
Please advise. Any ideas, resources, sample code highly appreciated. thanks in advance
ASKER
>>>That's just how Eclipse shows the structure, the actual structure on disk is more like this..
that make more sense, why does eclipse change the structure. please advise
that make more sense, why does eclipse change the structure. please advise
why does eclipse change the structureIt's not really that it *changes* the structure, just that it represents it in a different way. As for why, well it's probably just a matter of preference, but I guess it allows you to easily see from a top level, ie. without first having to drill into subfolders, where the different parts are, as in Java source code, resource files, and files required for a web application.
This representation actually changes depending on what type of project Eclipse believes it to be. In the case of the screenshot in that link, it looks like the project isn't even fully configured as a webapp, as otherwise it would have given a whole different set of top level folders that make navigating a webapp project a little simpler.
ASKER
src
-> main
-> java
-> (all *.java files)
-> resources
-> (all non *.java files needed by the app that AREN'T web related)
-> webapp
-> (all web related app files, such as jsp's, dispatcher servlet .xml files, etc)
Does above structure applies to maven web projects also. I always see maven web project structure bit weird, different compared to regular web projects. please advise
Does above structure applies to maven web projects also.Why do you say "also"? This IS the structure of a maven web project.
If it was NOT a maven web project, ie. just a standard maven project, there would be no webapp directory, just "java" and "resources".
And yes maven, in general, has a different structure to most anything else, ie. a maven web project will be different to a regular web project, and a maven java project will be different to a regular java project. It is just how maven does things!
ASKER
>>>If it was NOT a maven web project, ie. just a standard maven project, there would be no webapp directory, just "java" and "resources".
I have attached both non maven and maven projects.
I see no webapp directory.
I do not see 'resources' there. is it is same as ' Java Resources'
Also in maven project
' Java Resources' has--->src/main/resources
At bottom there is again
src--main---resources.
I also see one 'deployment descriptor at the top and ther web.xml' at bottom for maven project. i wonder why things are repeating for maven projects
Please advise
MavenStr1.jpg
I have attached both non maven and maven projects.
I see no webapp directory.
I do not see 'resources' there. is it is same as ' Java Resources'
Also in maven project
' Java Resources' has--->src/main/resources
At bottom there is again
src--main---resources.
I also see one 'deployment descriptor at the top and ther web.xml' at bottom for maven project. i wonder why things are repeating for maven projects
Please advise
MavenStr1.jpg
ASKER
please advise
I see no webapp directory.I do, it is the 5th item "up from the bottom" in your screenshot. It is only in the maven project (and not the regular project) because as I said in the previous post, maven/non-maven projects have different structures. The equivalent in the regular project is the "WebContent" directory that you can see in the screenshot.
I do not see 'resources' there. is it is same as ' Java Resources'Again, I do see it, it is the 6th item "up from the bottom" in your screenshot. And again, it is only in the maven project because they have different structures. There is no real equivalent to the resources folder in a regular, non-maven project.
Also in maven project
' Java Resources' has--->src/main/resources
At bottom there is again
src--main---resources.
I also see one 'deployment descriptor at the top and ther web.xml' at bottom for maven project. i wonder why things are repeating for maven projectsThese two issues (the fact that things are repeated in the project view) is a feature of Eclipse (nothing to do with maven). You will notice the in both projects, Eclipse has placed a "Deployment Descriptor" item at the top of each project, as well as you can see the actual source file for this, web.xml, near the bottom of each project. Note though that these AREN'T two separate things, the "Deployment Descriptor" item is just like a "view" of the web.xml file, ie. if you were to go into web.xml and modify some settings in there, those changes would be reflected in the entries under "Deployment Descriptor" and vice versa.
Same for the src/main/resources, there is only ONE of these folders, Eclipse is just presenting a "view" of the folder under "Java Resources". Again if you were to add a file under the "Java Resource" -> "src/main/resources" folder, you would also see the new file at the bottom of the project under "src/main/resources".
All this is just Eclipse's way of attempting to make life easier, by taking the "filesystem layout" view of the project and trying to make a more meaningful "developer centric" view of the project, ie. web.xml is a fairly common file that needs to be edited,modified, etc so rather than just have it buried in a few levels of filesystem folders, such as "src/main/webapp/WEB-INF/w
ASKER
In my project
src
-> main
-> java
-> (all *.java files)
-> resources
-> (all non *.java files needed by the app that AREN'T web related)
-> webapp
-> (all web related app files, such as jsp's, dispatcher servlet .xml files, etc)
I see one more web-resource apart from ,java, resources, webapp.
src
-> main
-> java
-> (all *.java files)
-> resources
-> (all non *.java files needed by the app that AREN'T web related)
-> webapp
-> (all web related app files, such as jsp's, dispatcher servlet .xml files, etc)
-> web-resources
what does web-resource is used for. please advise
src
-> main
-> java
-> (all *.java files)
-> resources
-> (all non *.java files needed by the app that AREN'T web related)
-> webapp
-> (all web related app files, such as jsp's, dispatcher servlet .xml files, etc)
I see one more web-resource apart from ,java, resources, webapp.
src
-> main
-> java
-> (all *.java files)
-> resources
-> (all non *.java files needed by the app that AREN'T web related)
-> webapp
-> (all web related app files, such as jsp's, dispatcher servlet .xml files, etc)
-> web-resources
what does web-resource is used for. please advise
ASKER
Please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
src
-> main
-> java
-> (all *.java files)
-> resources
-> (all non *.java files needed by the app that AREN'T web related)
-> webapp
-> (all web related app files, such as jsp's, dispatcher servlet .xml files, etc)