Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven tomcat plugin with mysql driver in $catalina_home/lib

i am trying to use a container managed datasource (via context.xml) in tomcat. The corresponding jar file needs to go in $catalina_home/lib, otherwise tomcat can't find it. (not in webapp/WEB-INF/lib, because it is managed by the webserver, not by the application itself)

the problem is: I am using maven with the maven-tomcat-plugin, so I don't have a $catalina_home (everything is distributed in my .m2 -repository).

So the question is: how can I add the mysql driver jar to the classpath of the tomcat server (mvn tomcat:run)?

thanks a lot,

gerolf.

like image 936
gerolf Avatar asked Feb 16 '10 13:02

gerolf


1 Answers

Did you try to add the JDBC driver as a dependency of the maven-tomcat-plugin:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
      ...
    </configuration>
    <dependencies>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.0.5</version>
      </dependency>
    </dependencies>        
  </plugin>
like image 107
Pascal Thivent Avatar answered Oct 21 '22 12:10

Pascal Thivent