Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

using bitbucket as a maven repository

zamek z October 23, 2018

Hi All, 

I want to use Bitbucket as a maven repository. I created a maven-repository git repo and I can upload artifacts with wagon-git. But I cannot download an artifact from Bitbucket with https.  How can I define a private bitbucket repository as a maven repository? 

I found some info like this:

  <repositories>                                                                                               
       <repository>                                                                                             
           <id>id</id>                                                                                  
           <url>https://bitbucket.org/my_account/maven-repository/raw/releases/repository/</url>                
       </repository>                                                                                            
   </repositories>

 

What is the correct url to access my repository?

thanx

Zamek

4 answers

1 vote
Antony Cartwright March 6, 2019

I'm doing this too using: https://synergian.github.io/wagon-git/bitbucket.html.

 

A Git repository is a low-cost option to maintain a private repository. It's not a fully functional repository manager but a useful way to have always on HTTP access without running a service yourself.

<repositories>
<repository>
<id>myrepository-releases</id>
<name>Releases using BitBucket</name>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://api.bitbucket.org/1.0/repositories/myaccount/myrepository/raw/releases</url>
</repository>
</repositories>

The last "releases" is the branch name in "myrepository" where the web URL on ButBucket would be https://bitbucket.org/myaccount/myrepository/src/releases/.

JioWalletSDK June 12, 2019
https://api.bitbucket.org/1.0/ ? this is still functional 
Antony Cartwright June 15, 2019

I'm still using the config above without error, however... I note that my repository didn't get updated when I last ran:

mvn deploy

 Last success April 22nd. To be continued.

Antony Cartwright June 15, 2019

I can confirm a variant of this URL is functional:

https://api.bitbucket.org/1.0/repositories/{acc}/{repo}/raw/releases

 After the time spent not finding a graceful storage solution, I'm going to switch to a remote actual artifact repository that is only running when needed.

The constraints on BitBucket for storage and the difficulty caused by using Git for file management are probative. 

1 vote
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2018

Hello,

Bitbucket is not a maven repository. You should use such repositories as Nexus, Artifactory and so on.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2018

Also you can find a solutin here:

https://jeroenmols.com/blog/2016/02/05/wagongit/

zamek z October 23, 2018

Hi Alexey,

Thx for your answer, I also know BB is not the best maven repository, but it isn't my decision. 

I already read this post but I cannot set correctly it with maven. I have a server in my settings.xml like this:

<settings>                                                                                               
           <servers>                                                                                            
               <server>                                                                                         
                   <id>my_bb_name</id>                                                                          
                   <username>my_bitbucket_user_name</username>                                       
                   <password>my_bitbucket_password</password>                                 
               </server>                                                                                        
           </servers>                                                                                           
       </settings>      

and in my pom.xml:

<repositories>                                                                                               
       <repository>                                                                                             
           <id>my_bb_name</id>                                                                                  
           <url>https://bitbucket.org/my_bb_name/maven-repository/src/releases/</url>                           
       </repository>                                                                                            
   </repositories>

My question is that, how can I set the simple https accessing of a bitbucket repo?

thx

Zamek       

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2018

I have never configured bitbucket as a maven repository because it is not created for it. I think we should use the right tools for each thing.

Like # people like this
Antony Cartwright June 23, 2019

@zamek z I am now using Sonatype Nexus3 RepositoryManager as a Docker container in an Amazon EC2 instance (t2.small) with a volume to retail state. My journey began here: https://hub.docker.com/r/sonatype/nexus3/

  • My initial motivations for using Git were: Always on + Serverless + Free
  • With EC2 I have: On-demand + An official container + Pay per usage

The wrinkles of this solution are that you need to start a repository before a build and remember to stop it after (or pay 24x7). To solve this I have a scheduled BitBucket pipeline to stop the instance in the early hours of the morning and another scheduled job to start the repository before any automated builds.

For a rainy day project, I'll pull all the elements into an Open Source project designed to run the minimal repository manager and publish to an always-on read-only repository on S3.

0 votes
Harsha May 21, 2020

I am using [wagon-git][1] version 0.2.5 to deploy and consume the artifact from my private bitbucket. Following the same steps as given in the documentation http://synergian.github.io/wagon-git/bitbucket.html.

Error:

`Could not resolve dependencies for project com.xxx:yyy:jar:1.0.0: The following artifacts could not be resolved: com.aaa:bbb:jar:3.0: Could not find artifact com.aaa:bbb:jar:3.0 in xxx_repo (https://api.bitbucket.org/2.0/repositories/company/xxx_repo/raw/releases)`

Research:

From my research, I found many suggested the problem in repository URL so I changed to
https://bitbucket.org/company/xxx_repo/raw/releases/ from this URL I am able to access the repo but the compilation fails with an error saying zip END header not found

`Compilation failure:
[ERROR] Error reading /home/msuser1/.m2/repository/com/aaa/bbb/3.0/bbb-3.0.jar; zip END header not found`

And too many warning saying checksum validation failed.

`[WARNING] Could not validate integrity of download from https://bitbucket.org/company/xxx_repo/raw/artifacts/com/aaa/bbb/3.0/bbb-3.0.jar: Checksum validation failed, expected <!doctype but is 2f947caee42a20633fb9c412ew53591f64b8c4481`

Solution:

**What is the exact URL for consuming the artifact from a private bitbucket?**

**Can anyone provide complete working steps to deploy and consume artifact from private bitbucket using wagon-git?**

[1]: http://synergian.github.io/wagon-git/bitbucket.html

aurbaez August 5, 2020

I'm facing the same issue.

I have a repository configured in my pom.xml with this URL:

https://api.bitbucket.org/1.0/repositories/guambo/encrypt/raw/releases

And we know they have taken out API v1.0, and currently there's the v2.0, however it's totally different from the former one.

What could be the URL for the same purpose in v2.0..?

<repositories>
    <repository>
        <id>guambo-encrypt</id>
        <url>https://api.bitbucket.org/1.0/repositories/guambo/encrypt/raw/releases</url>
    </repository>
</repositories>

This doesn't work anymore because BitBucket's API v1.0 is deprecated..

Thanks..

Bytor August 20, 2021

Did you find a fix for the deprecated 1.0 API and the new URL to use?

0 votes
zamek z June 12, 2019

Yes I also think, using bitbucket as a maven repository is not the best choice. Installing a nexus sonatype in a docker environment is much more simple. 

 

thx

Zamek

Antony Cartwright June 13, 2019

The flexibility and control from running an always-on container is an advantage too, at a cost. The key advantage of a Git repository backing a Maven artifact repository is that you probably already have a source control repository. It doesn't scale, file sizes are limited and archiving is awkward, but it is always-on high availability for no extra cost.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events