Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven : deploy libraries to WEB-INF/lib

 
Swerrgy Smith
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I have some libraries which existe in .m2/repository. But when I start my Tomcat server, I always get the errors that the application did not find these libraries. I have to copy manually these libraries to WEB-INF/lib folder.

How can these libraries be deployed automatically to WEB-INF/lib folder?

Thank you.
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you declared your libraries as dependencies in your pom.xml? If not: you should because then Maven will take care copying your libs.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your Maven dependencies, what scope did you use? For a "compile" scope, Mavne places the JAR into WEB-INF/lib, for "provided" it does not place the JARs there.
 
Swerrgy Smith
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:In your Maven dependencies, what scope did you use? For a "compile" scope, Mavne places the JAR into WEB-INF/lib, for "provided" it does not place the JARs there.


Hi Peter, how can I check what scope I am using?
 
Adrabi Abderrahim
Greenhorn
Posts: 8
Eclipse IDE Fedora Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

if you've Maven configured, you can just execute command

mvn compile


in root of your maven project (folder that contains pom.xml), but if you're using like eclipse plugin for maven :
- Run As
- Run Configuration
- New Maven Build
- in "Goals" type "compile"
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swerrgy Smith wrote:
Hi Peter, how can I check what scope I am using?


In your pom you define your dependency e.g. like:


If you are ommitting the scope-tag the default scope (=compile) is used. See also here.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic