Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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.
 
Everybody's invited. Except this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic