Gili
Gili

Reputation: 90023

How to add resources to the classpath of Maven plugins?

I've got a Maven plugin that depends on slf4j for logging. The default behavior is too chatty for my liking but I can't figure out how to add my logback.xml to the plugin's classpath.

<plugin>
  <dependencies>
  </dependencies>
</plugin>

allows you to add dependencies to the plugin's classpath, but how do you add local (resource) directories?

Upvotes: 2

Views: 622

Answers (2)

Eugene Kuleshov
Eugene Kuleshov

Reputation: 31795

You have to wrap your logback.xml into a proper Maven artifact (i.e. a jar) and install it to local repository or deploy to your shared repository, or use systemPath in your dependency declaration to point to a jar placed somewhere inside of your project, which is highly not recommended.

The reason for this is reusability of your build. Think how others would be able to reproduce it.

Upvotes: 1

bmargulies
bmargulies

Reputation: 100013

You don't. You must package them up as an artifact and add it as a dependency.

Upvotes: 0

Related Questions