Reputation: 9934
I am running jetty with maven using the jetty plugin using the command mvn jetty:run.
Is there a command line option to add an external directory to the classpath? Something like the java -cp option?
TIA
Upvotes: 1
Views: 3089
Reputation: 21
If you define a Maven property for extraClasspath
, you can pass a custom extraClasspath value with a command line system property. For example, if you're POM had the following:
<properties>
<jetty.extraClasspath />
</properties>
...
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.14.v20181114</version>
<configuration>
<webApp>
<extraClasspath>${jetty.extraClasspath}</extraClasspath>
</webApp>
</configuration>
</plugin>
You could specify the extra classpath with mvn jetty:run -Djetty.extraClasspath=../resources/
.
Upvotes: 2
Reputation: 15549
From what is printed by mvn jetty:help -Ddetail=true -Dgoal=run
, it looks like it is not possible from command line
Upvotes: 0
Reputation: 7722
Have you tried the solution suggested here:
Adding classpath to jetty running in maven integration-test
<webAppConfig>
<contextPath>/nportal</contextPath>
<!-- All I want to do here is add in the /etc/jetty/classes for runtime files. For some reason I have to also add back in the /target/classes directory -->
<extraClasspath>${basedir}/target/classes/;${basedir}/etc/jetty/classes/</extraClasspath>
</webAppConfig>
Upvotes: 1