Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven

 
Elsy Mena
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don't know if this is the correct forum, I tried to find somethig about maven but I didn't find anything.

I am new working with maven, I am trying to create an old web application as a maven project, I don't know how to create the directory structure for that. I used the archetype maven-archetype-webapp, but now I don't know where to put my jsps and everything. I have a classes folder in my WEB-INF folder, but I don't know if I have to take it off, because maven has a directory called target where it puts all complied classes.

I don't kno If somebody can help me with this.

Thank you in advance

Elsy
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to a more appropriate forum.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Elsy,

was it really so hard to find information? I've often heard or read that Maven documentation was really poor in the past but by now there's quite a lot of information on the Maven homepage itself and there are tons of other articles etc.

But for your specific problem have a lookt at Maven standard directory layout.

Here you can see the directory layout it expects for any project. You can still customize it but you save time and trouble just by following the Maven conventions. For web applications all the "web" specific part go to the "src/main/webapp" directory, that is HTMLs, JSPs and WEB-INF for example. I hope this helps solving your problem

For general information and examples about Maven Sonatype is a very good source of information. As I said the Maven homepage and various other pages are really valuable, too.

Marco
 
Elsy Mena
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Marco, I did found the first link you told me, but I wanted more information. The second one its very good also.

Thank you again for your help and for your kindness, have a great day
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome ;-) If you have more questions just let us know...

If you take some time to learn you will surely see the full advantages of Maven based projects. Once you know how everything works and if you agree to the conventions (like the directory structure) it's really, really easy to use. And it simply works! Use it from the command line, any of the popular IDEs or other tools like continuous integration servers and it just works without any manual configuration.

Plus there are lots of helpful plugins for additional tasks. For example you could use a plugin which can automatically deploy your web application in case of a successful build and test run etc.

Marco
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should also read the free "Maven the Definitive Guide", it pretty much guides you through everything you need to know.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say that's basically the link from Sonatype I posted above

Marco
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18214
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We definitely do encourage people to RTFM, although it's a point of pride that we don't flame people into it here at the JavaRanch like some forums do.

Still, here's a freebie, since it will save you a lot of pain:

Don't put files in the target directory!

The entire target directory and its children are subject to being deleted by maven. In fact, "mvn clean" will do exactly that. So anything you want not to get deleted shouldn't go there. In fact, you really shouldn't put anything there. It belongs to maven, and if maven wants something there, it will put it there.

Because Maven deletes target and its children, when using a source code control system such as Subversion or CVS, you should put the target directory into the project vcs "ignore" list.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic