在$ catalina_home / lib中使用mysql驱动程序的maven tomcat插件 [英] maven tomcat plugin with mysql driver in $catalina_home/lib
问题描述
我正在尝试在tomcat中使用容器管理的数据源(通过context.xml)。相应的jar文件需要进入$ catalina_home / lib,否则tomcat找不到它。 (不是在webapp / WEB-INF / 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)
问题是:我正在使用maven和maven-tomcat-plugin,所以我没有$ catalina_home(一切都在我的.m2 -repository中发布)。
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).
所以问题是:我怎么能将mysql驱动程序jar添加到tomcat服务器的类路径中(mvn tomcat:run)?
So the question is: how can I add the mysql driver jar to the classpath of the tomcat server (mvn tomcat:run)?
非常感谢,
gerolf。
推荐答案
您是否尝试将JDBC驱动程序添加为maven-tomcat-plugin的依赖项:
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>
这篇关于在$ catalina_home / lib中使用mysql驱动程序的maven tomcat插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!