Search code examples
javamaven-2rmi

How to reference a jar (containing only stubs) created with rmic:package maven goal from a POM?


I have a RMI app and the Stubs are generated with maven (rmic:rmic).

Then I use the rmic:package goal and get a nice little jar with only the stubs.

Now the bis question is: How can I reference this jar from the poms of other projects?

I cant give it an ArtifactId (or do I?!) and when I use the classifier, it downloads all dependecies of the original Project and NOT the jar with the stubs.

Please give me a hint, how I can actually use this jar in a nice behaving maven way :-)

thanks in advance, I vote for stuff and accept answers, so you'll get your points!


Solution

  • You could indeed create a project/POM for your Stub Project.

    You could bind the rmic:rmic goal to the generate-sources phase of a "Stub Project" POM; so that the compile phase of the build 1) creates the stub classes and then 2) compiles them.

    This would then allow you to package the project (as a JAR, or whatever else) and deploy it to a Maven repository like any other project.

    From there, you would simply reference the artifact as a <dependency> of the projects that depend on the stubs.