File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding war creation in Maven

 
Kousik Majumder
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kousik Majumder
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go read David's reply again - change the default Maven project directory structure at your own risk, or headache.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic