Maven: How to use local lib

Sometime ago I saw me before a situation that I’ve never had passing before. I needed use my local lib on Java maven project.

To do that I followed the steps:

Step One: Put in my local library into maven repository

mvn install:install-file -Dfile=home/victor/dev/Example.jar -DgroupId=br.com.example -DartifactId=Example -Dversion=1.0.0 -Dpackaging=jar

Enter fullscreen mode Exit fullscreen mode

Step Two: Install maven dependencies

mvn clean install

Enter fullscreen mode Exit fullscreen mode

Step Three: Use the library in the project

Add the pendency in the pom.xml file like that:

<dependencies>
  ...
  <dependency>
    <groupId>br.com.example</groupId>
    <artifactId>Example</artifactId>
    <version>1.0.0</version>
  </dependency>
  ...
</dependencies>

Enter fullscreen mode Exit fullscreen mode

That’s it!

I hope this helps you.

原文链接:Maven: How to use local lib

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容