• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regarding war creation in Maven

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go read David's reply again - change the default Maven project directory structure at your own risk, or headache.
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic