开发者

Reference artifacts uploaded by Maven Assembly Plugin

We have configured our maven assembly plugin to create individual jars files that are uploaded to our local maven repo via the deploy plugin.

However we need to reference those jar files (the ones created by the assembly plugin) within other projects as maven dependencies. Any ideas on how we can accomplish that would be greatly appreciated.

Update For example :

-client (pom.xml - groupId=com.mycompany artifactId=cl开发者_如何学Pythonient)
  |-src
    |-main
      |-java
        |-authentication
        |-billing
        |-reporting

This gets split up into 3 different jar files by the maven assembly plugin and publish to our local repo as :

-client-authentication.jar
-client-billing.jar
-client-reporting.jar

How do we reference client-authentication.jar as a dependency for another project without it having it's own pom file?


Did you try to include the classifier in the dependency (your artifacts have a version, right?):

<dependency>
  <groupId>com.mycompany</groupId>
  <artifactId>client</artifactId>
  <version>1.0-SNAPSHOT</version>
  <classifier>authentication</classifier>
  <type>jar</type>
</dependency>

But I need to stress that you are going against the one artifact per module golden rule, you should split your code into three modules.


You will need to add that local repo to your other project's poms

<repositories>
  <repository>
     <id>my-local-repo</id>
     <name>My companywide local repo</name>
     <url>{the actual url of your repo}</url>
  </repository>
</repositories>

This being done, you can add the dependency to those artifacts in those same poms

  <dependency>
     <groupId>{some.group}</groupId>
     <artifactId>{my.local.repo.artifact}</artifactId>
     <version>{some.version}</version>
  </dependency>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜