I am used to the layout provided by the Dynamic Web project in eclipse where you have all your Java code under the src folder, your JSP files, etc under the WebContent folder and the WEB-INF resides right under the WebContent folder. Also, the Output folder is hidden from the project tree. Maven has its own format which I find somewhat confusing, it creates its now target folder and source/main/java folder and some test folder under target…
Is there a way to create a Maven project and have it use the Dynamic Web project project tree layout?
I tried changing the Deployment Assembly entries to match that of the Dynamic web project and have also update the Java Build Path src and output to match the Dynamic Web project one but I get strange, cryptic unfriendly errors when I do a Run/Install. Can you provide me with details on how to go about doing this cleanly?
What you need to get used to using is the concept of
archetypesin Maven.The concept is like project templates ready for you to use that are automatically understood by Maven.
will get you an interactive listing of all the available
archetypesWhat you want to look for is
maven-archetype-webappthis will give you a basic skeleton framework of what Maven is expecting a webapp to look like.There are others that include support for different frameworks and what not.
will filter out all the choices that are webapp
archetypesThen it is a simple
mvn clean packageand you get an exploded dir and a.warin thetargetdirectory, you can even enable the Tomcat plugin to automatically deploy to Tomcat. Other J2EE servers are supported as well.Then you use the Maven plugin for eclipse to load the project based on the
pom.xmlfile.You could create your own non standard layout and get it working by manually configuring everything thing and create an
archetypeout of it but that kind of defeats the purpose of a single way of doing things with a tool like Maven.