How to add directory to classpath with jetty-maven-plugin 9.x?

In my Maven project, I used the version 7 plugin with the -maven plugin, and I used to add the directory to the Jetty path by setting the "extraClasspath" parameter to "webAppConfig", for example 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 upgrade to the latest version of the jetty-maven plugin, and I found that there was no longer an "extraClasspath" parameter.

How can I add a directory to the classpath with the latest version of the gateway plugin?

+4
source share
2 answers

It looks like it has moved ... this is how I started working:

 <webApp> <extraClasspath>${basedir}/local/properties</extraClasspath> </webApp> 
+2
source

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 baseResource instead if you have multiple servers from which you want to use static content. This is an array of dir names.

If you want to change the base directory, you should use:

baseResource

The path from which Jetty serves static resources. The default is src/main/webapp .

Here's how I used 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> 
0
source

Source: https://habr.com/ru/post/1487936/


All Articles