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!
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.
Use a classifier of client
.
Example:
<!-- This references the stub jar -->
<dependency>
<groupId>com.example</groupId>
<artifactId>the-dependency</artifactId>
<version>1.0</version>
<classifier>client</classifier>
</dependency>
<!-- This references the jar -->
<dependency>
<groupId>com.example</groupId>
<artifactId>the-dependency</artifactId>
<version>1.0</version>
</dependency>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.