How to use Bitbucket as a maven remote repository?

前端 未结 4 1002
心在旅途
心在旅途 2021-01-31 03:29

We are planning to use bitbucket as source code repository as well remote repository for our maven based projects. I have created a repository on bitbucket something like below:

相关标签:
4条回答
  • 2021-01-31 04:07

    You can try http://synergian.github.io/wagon-git/index.html it has instructions for bitbucket.

    An alternative to using bitbucket is to use a dropbox folder for company. https://code.google.com/p/peter-lavalle/wiki/MavenOnDropBox Contains a very good step by step guide on how to do this.

    0 讨论(0)
  • 2021-01-31 04:09

    I've now managed to get this working. I followed these instructions and I can deploy artifacts to bitbucket and then use those in another maven project.

    The tweaks I had to make to get it working were:

    1. Upgrade Wagon-Git to v0.2.0
    2. Configure Git using git config --global user.email as it didn't seem to be picking up the --local setting I had used previously

    I also manually added a README.md to the repo but I don't think this was actually required.

    Once you have successfully deployed to the repo you should see all your files in the usual way via the BitBucket web front end.

    0 讨论(0)
  • 2021-01-31 04:28

    How can I push my company specific project jars into the above remote repository using the project specific pom.xml?

    You can't. shouldn't in my opinion.

    Bitbucket is not intended to be a maven repository. Trying to get maven to deploy artifacts to BitBucket to it is just wrong may contravene Atlassian's terms of use. On the other hand it might be fine.

    You either need to should instead deploy to your own local repository or a public one.

    0 讨论(0)
  • 2021-01-31 04:34

    Install jars in a local maven repository.

    Make a directory e.g. maven-repo/repository

    cd into maven-repo

    execute the following (replacing the arguments by the ones that are relevant to your jar):

    mvn install:install-file -DgroupId=com.rapid_i -DartifactId=rapidminer -Dversion=5.3.006 -Dfile=/path/to/artifact/rapidminer.jar -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=./repository  -DcreateChecksum=true
    

    Share the folder to a BitBucket public repository.

    Create a repository in your pom.xml pointing to you bitbucket folder.(you must use /raw/master in the path https://bitbucket.org/your-user-or-group/your_maven-repo/raw/master/ !!)

    <project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>org.activeintel</groupId>
    <artifactId>rapidminer-proj</artifactId>
    <version>0.0.1</version> 
    
    <!-- Dependency to jar on Maven Repository on Git-BitBucket -->
    <dependencies>
        <dependency>
            <groupId>com.rapid_i</groupId>
            <artifactId>rapidminer</artifactId>
            <version>5.3.006</version>
        </dependency>
    </dependencies>
    
    <!-- Maven Repository on Git-BitBucket -->
    <repositories>
    <repository>
        <id>neil_rubens-repository</id>
        <url>https://bitbucket.org/your-user-or-group/your_maven-repo/raw/master/repository/</url>
    </repository>
    </repositories>
    
    </project>
    

    Source: Hosting Maven Repository for third-party jars on Git (Bitbucket/Github)

    0 讨论(0)
提交回复
热议问题