ryber
ryber

Reputation: 4555

Copy Maven dependency to webapp directory

this is similar to this question but with a twist.

I have a jar in a remote maven repository. This jar is actually a applet that gets run in the web browser. So it needs to get copied into webapp/resources/ directory.

I'm trying to use the maven-war-plugin to copy it and I'm so close but I can't seem to get the syntax quite right since the jar is just in the local m2 directory and not really inside the build directory at all (although I believe it is in the resulting war.)

Upvotes: 1

Views: 1774

Answers (2)

Ryan Stewart
Ryan Stewart

Reputation: 128749

The dependency plugin can copy artifacts by maven coordinate from a repository (local or remote) to arbitrary directories. Just add an execution of it somewhere before your war is built to copy the jar to an appropriate place.

Upvotes: 1

Jon7
Jon7

Reputation: 7215

Try the copy task of the maven resources plugin. This will let you call out your jar just like you do a dependency, but it will copy it wherever you like so that it can be included in your war.

Upvotes: 1

Related Questions