tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID" <>
Subject Options for specifying the classpath to find a database driver
Date Thu, 09 Mar 2017 00:28:25 GMT
I'm running a small REST service in Tomcat.  It presently queries an Oracle db to get some
data.  In the config on the server, I put the JDBC jar into the "lib" directory of the installation,
so it can find it without any special classpath augmentation.

However, in the server config within Eclipse, when I'm prototyping my changes, I specify a
"classpath" property on the "Resource" with a "mvn:" prefix.  It doesn't make sense to me
to manually copy the JDBC driver jar into the Tomcat instance running in Eclipse, so I reference
it from my local Maven cache.

However, it's sort of an accident that that works.  I'm actually building this particular
application with Gradle, which does not write to the local Maven cache (although I can read
from it).  I work on a related application that is built with Maven, that gets the same artifact,
so this manages to work.

I'm now changing the REST service to also query a mysql (maria) db.  I have the driver jar
in our intranet maven repo, so the Gradle build can get it.  However, I don't have another
Maven-built application using this to install it into the local Maven cache.  I suppose I
could also use the "maven-dependency-plugin" on the command line to directly download the
artifact, but I'm looking for other options for doing this "cleanly".

After I do my Gradle build at least once, the driver jar will be available on my local disk
in a couple of places (my build stores the driver jars in a subdir of "build" to make it easier
to install them on the server), so I suppose I could make the "classpath" value be an absolute
(perhaps workspace-relative) path.  Is that my only other semi-reasonable alternative?

View raw message