tags:

views:

16

answers:

1

I have created a maven plugin. I have some classes in the plugin, which I want to make available to the plugin client after execution.

The problem is that a project of type maven-plugin is also a jar, so I simply can't use maven-jar-plugin and maven-install-plugin to install the jar (having the classes) as a dependency.

Any ideas on how to do this?

A: 

I have created a maven plugin. I have some classes in the plugin, which I want to make available to the plugin client after execution.

I see two options:

  1. declare a dependency on the plugin in the client:

    <dependency>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.0.2</version>
      <type>maven-plugin</type>
    </dependency>
    
  2. put the shared classes in a shared module (with a packaging of type jar) and declare a dependency on this shared module in both the client and the plugin.

Personally, I find the second option cleaner (and you won't get all the transitive dependencies of the plugin on the classpath).

Pascal Thivent
Thanks for answering Pascal. This is certainly a solution. However, the thing I am trying out, is , that , when the plugin runs, a jar is available to the client. In that way, the plugin is in its completeness. The dependency on the dependency makes the plugin a bit incomplete. But, I don't thing that is possible.Thanks again.
Paritosh Ranjan
@Paritosh Yes, I understand the intend. Unfortunately, I don't know how to achieve this (if it's possible).
Pascal Thivent