Shankar Guru
Shankar Guru

Reputation: 1161

Import project from bitbucket to local maven repository

I have a maven project in bitbucket account. I need to add that the project in my local maven repository so that I can refer that project as a maven dependency in my main project's pom.xml.

That is, perform below steps

1) Clone the project 2) run maven build install This will add to local maven repository

Please let me know if there is a way to achieve the same (in similar ways to connecting to maven public repository) ?

Upvotes: 2

Views: 1336

Answers (2)

k_o_
k_o_

Reputation: 6288

Look into jitpack.io. It can create a Maven repository for a GitHub project and also other hosters like BitBucket, GitLab, Azure, Gitee.

I have choosen a random Maven based project, here fastconverter. It not GitHub is used, the full URL has to be provided. The created jar is published then here.

Upvotes: 0

Yogi
Yogi

Reputation: 1895

You can achieve this by defining repositories in pom file of the project where you want to use project 1 as a dependency.

For eg.

Git clone path of Project 1: https://github.com/yogi21jan/project1

Add below code in child project:

<repositories>
    <repository>
        <id>YOUR-PROJECT-NAME-mvn-repo</id>
        <url>https://raw.github.com/YOUR-USERNAME/YOUR-PROJECT-NAME/mvn-repo/</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

And finally Add this project as a dependency:

<dependency>
     <groupId>group id of project 1</groupId>
     <artifactId>artifcat id of project 1</artifactId>
     <version>required version</version>
</dependency>

Upvotes: 1

Related Questions