如何使用Bitbucket作为maven远程仓库?

2024-03-18

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

https://bitbucket.org/mycompany/maven-repository 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部署命令,这是我得到的错误:

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 

感谢您的帮助。


你可以试试http://synergian.github.io/wagon-git/index.html http://synergian.github.io/wagon-git/index.html它有关于 bitbucket 的说明。

使用 bitbucket 的另一种方法是使用公司的保管箱文件夹。https://code.google.com/p/peter-lavalle/wiki/MavenOnDropBox https://code.google.com/p/peter-lavalle/wiki/MavenOnDropBox包含关于如何执行此操作的非常好的分步指南。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用Bitbucket作为maven远程仓库? 的相关文章

随机推荐