如何使用Bitbucket作为Maven远程存储库? [英] How to use Bitbucket as a maven remote repository?

查看:109
本文介绍了如何使用Bitbucket作为Maven远程存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划使用bitbucket作为源代码存储库以及基于maven项目的远程存储库。我创建了一个名为bitbucket的仓库,如下所示:



https:// bitbucket.org/mycompany/maven-repository



如何使用特定于项目的pom.xml将公司特定的项目jar包推送到上述远程存储库中?你能帮我一个样本pom.xml吗?我们将推动所有公司特定的jar进入上面的远程仓库,供公司内的其他项目用作maven依赖项。



这是我到目前为止尝试的将一个示例项目推送到远程仓库中:

 < 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> com.mycompany< / groupId>
< artifactId> corporate-pom< / artifactId>
< version> 1.0< / version>
< packaging> pom< / packaging>
< distributionManagement>
< repository>
< id> MyCompanyRepo< / id>
< url> https://bitbucket.org/mycompany/maven-repository< / url>
< / repository>
< / distributionManagement>
< build>
< pluginManagement>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-deploy-plugin< / artifactId>
< version> 2.7< / version>
< / plugin>
< / plugins>
< / pluginManagement>
< / build>



以上是父pom ,这将被公司内所有其他项目包括在内,我希望将其推送到远程回购以供其他公司特定项目使用。



当我运行 mvn deploy 命令,这是我得到的错误:

  C:\Cooler\Work \dev\Projects\mycompany\wal-common> mvn部署
[警告]
[警告]构建有效设置时遇到一些问题
[警告]无法识别的标记: 'snapshotPolicy'(position:START_TAG seen ...< / layo
ut> \\\
< snapshotPolicy> ... @ 203:27)@ C:\Users\cooler\.m2\\
[INFO]
[信息]扫描项目...
[信息] -------------------------------------------------- --------------------
[INFO] Building corporate-pom 1.0
[INFO] ----------- -------------------------------------------------- -----------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install(default-install)@ corporate-pom
---
[INFO]将C:\Cooler\Work\dev\Projects\mycompany\wal-common\pom.xml安装到C:\
用户\cooler\.m2\repository\com\mycompany\corporate-pom\1.0\corporat
e-pom-1.0.pom
[信息]
[ INFO] --- maven-deploy-plugin:2.7:deploy(default-deploy)@ corporate-pom ---
上传:https://bitbucket.org/mycompany/maven-repository/com/mycompany/ corporate-pom / 1.0 / corporate-pom-1.0.pom
[INFO] ------------------------------ ------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------ ------------------------------
[信息]总时间:1.607s
[信息]完成at:Tue Sep 17 14:33:01 MST 2013
[INFO] Final Memory:7M / 122M
[INFO] ------------------ --------- ---------------------------------------------
[ ERROR]未能执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:
在项目中部署(d​​efault-deploy)corporate-pom:未能部署工件:Co
uld not转移工件com.mycompany:corporate-pom:pom:1.0从/
到CompanyREPO(https://bitbucket.org/mycompany/maven-repository):连接到h
ttp://:8080拒绝:拒绝连接:连接 - > [帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关
ch重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整的调试日志记录。
[错误]
[错误]有关错误和可能解决方案的更多信息,请阅读
d以下文章:
[错误] [帮助1] http:// cwiki .apache.org / confluence / display / MAVEN / MojoExecutionE
xception

感谢您的帮助。

解决方案

您可以尝试 http://synergian.github.io/wagon-git/index.html 它有bitbucket的指令。

使用bitbucket是为公司使用保管箱文件夹。 https://code.google.com/p/peter-lavalle/wiki/MavenOnDropBox 包含一个非常好的一步一步指导如何做到这一点。


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:

https://bitbucket.org/mycompany/maven-repository

How can I push my company specific project jars into the above remote repository using the project specific pom.xml? Can you help me with a sample pom.xml? We would be pushing all company specific jars into the above remote repository to be used by other projects within the company as maven dependencies.

Here is what I was trying so far to push one sample project into the remote repo:

<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>com.mycompany</groupId>
<artifactId>corporate-pom</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<distributionManagement>
    <repository>
        <id>MyCompanyRepo</id>
        <url>https://bitbucket.org/mycompany/maven-repository</url>
    </repository>
</distributionManagement>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.7</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

The above is a parent pom, which will be included by all the other projects within the company and I wanted to push this to the remote repo to be used by other company specific projects.

When I run mvn deploy command, this is the error I get:

C:\Cooler\Work\dev\Projects\mycompany\wal-common>mvn deploy
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'snapshotPolicy' (position: START_TAG seen ...</layo
ut>\n          <snapshotPolicy>... @203:27)  @ C:\Users\cooler\.m2\settings.xml,
line 203, column 27
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building corporate-pom 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ corporate-pom
---
[INFO] Installing C:\Cooler\Work\dev\Projects\mycompany\wal-common\pom.xml to C:\
Users\cooler\.m2\repository\com\mycompany\corporate-pom\1.0\corporat
e-pom-1.0.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ corporate-pom ---
Uploading: https://bitbucket.org/mycompany/maven-repository/com/mycompany/corporate-   pom/1.0/corporate-pom-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.607s
[INFO] Finished at: Tue Sep 17 14:33:01 MST 2013
[INFO] Final Memory: 7M/122M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy (default-deploy) on project corporate-pom: Failed to deploy artifacts: Co
uld not transfer artifact com.mycompany:corporate-pom:pom:1.0 from/
to CompanyREPO (https://bitbucket.org/mycompany/maven-repository): Connection to h
ttp://:8080 refused: Connection refused: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception 

Thanks for your help.

解决方案

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.

这篇关于如何使用Bitbucket作为Maven远程存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆