Reputation: 987
My Maven project was using jetty-maven-plugin version 7 and I used to add the directory to Jetty's classpath by specifying "extraClasspath" parameter in "webAppConfig", like here:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.0.1.v20091125</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
<extraClasspath>${basedir}/src/profiles/jetty</extraClasspath>
</webAppConfig>
<useTestClasspath>true</useTestClasspath>
</configuration>
</plugin>
Today I decided to update to the recent version of jetty-maven-plugin and I found that there is no "extraClasspath" parameter anymore.
How could I add the directory to the classpath with last version of jetty-maven-plugin?
Upvotes: 6
Views: 6168
Reputation: 21
According to https://www.eclipse.org/jetty/documentation/9.3.0.v20150612/jetty-maven-plugin.html, this should work to add a resource directory in addition to webapp:
resourceBases
Use instead of
baseResource
if you have multiple dirs from which you want to serve static content. This is an array of dir names.
If you only wanted to change the base directory, you'd use:
baseResource
The path from which Jetty serves static resources. Defaults to
src/main/webapp
.
This is how I implemented resourceBases
to include a directory in addition to src/main/webapp
:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webApp>
<contextPath>/pf</contextPath>
<descriptor>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</descriptor>
<resourceBases>
<baseResource>src/main/webapp</baseResource>
<baseResource>some/other/directory</baseResource>
</resourceBases>
</webApp>
</configuration>
</plugin>
Upvotes: 2
Reputation: 348
Looks like it moved... this is how I got it working:
<webApp>
<extraClasspath>${basedir}/local/properties</extraClasspath>
</webApp>
Upvotes: 4