aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Regarding war creation in Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Regarding war creation in Maven" Watch "Regarding war creation in Maven" New topic
Author

Regarding war creation in Maven

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 227
Hi all,

I have the below project structure:

myproject/jspFolder1/jsp1.jsp
myproject/jspFolder1/jsp2.jsp
myproject/jspFolder2/jsp21.jsp
myproject/jspFolder2/jsp22.jsp
myproject/WEB-INF/web.xml
myproject/images

Now I want the created war would be having the below structure:

myproject/jsp1.jsp
myproject/jsp2.jsp
myproject/jsp21.jsp
myproject/jsp22.jsp
myproject/WEB-INF/web.xml
myproject/images

How can I do that in Maven? Basically I want those jsp files put directly(not as it is in root folder) in the war file. Generally what I have seen that it just makes the .war file as it find in the webapp structure in the maven project.

Thanks in Advance,
Kousik
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

To be honest, I only fought with the expected Maven directory structure once. I lost. Is there any reason you can't do it the Maven way?
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 227
Can you give some code snippet which will put the jsp files from individual jsp folders of project directly to .war file that I have shown in my example.
All I need is the jsp files extracted from its individual folders and accumulated in the root of war file.
That's all.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

Have you read Better Builds With Maven? In chapter 4 it takes you step-by-step to create an Java EE app. You can ignore most of that an concentrate on just the "web" project since that is what you are looking for.

Have you read the Mavne 2 tutorial? It has a section on creating a WAR:
http://maven.apache.org/guides/getting-started/index.html#How_do_I_build_other_types_of_projects

JBoss In Action
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 227
Hi Peter,

In none of the places they have raised or talked about my requirement. All the examples are based on the default configuration. So please tell me if anyone know how I can change the directory structure in the created war file apart from the webapp directory structure like the example I have shown above.

Thank you.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

Go read David's reply again - change the default Maven project directory structure at your own risk, or headache.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding war creation in Maven
 
Similar Threads
JSF with Weblogic 8.1 sp3
Where can I find my log files??
Problems with Servlets + CSS + forward
Packageing concept of Maven with Ejb
How to Generate a War file