gpt4 book ai didi

java - 如何加载/添加第三方jar文件到bitbucket?

转载 作者:行者123 更新时间:2023-12-01 13:36:07 24 4
gpt4 key购买 nike

我想加载一些 Maven 存储库或任何其他此类存储库中不存在的 jar 文件。

为此,我在 bitbucket 上创建了一个名为“maven-repo”的存储库,并将其克隆到我的本地计算机。

现在我正在使用命令

mvn install:install-file -DgroupId=groupid -DartifactId=myid -Dversion=5.1 -Dfile=/path to file/filename.jar -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=./repository -DcreateChecksum=true

之后,我将该文件夹/存储库推送到 bitbucket 服务器。现在我想将它添加到我的 Maven 项目的 pom.xml 中。

我添加了这样的内容:

<repository>
<id>Hyperv </id>
<url>https://myurl/repository/</url>
</repository>

但它给我错误加载 jar 失败。

如何在项目中包含 jar 文件并导入类???

最佳答案

使用 Maven 进行部署

来自官方文档(我无法链接,这是一个 pop 窗口)

Bintray adds a new layer to traditional Maven repositories in the form of a package. A package acts as container for managing metadata about your project and its versions and may contain a collections of artifacts with different group ids.

When uploading files to a repository, you can associate them with specific package and version information in various ways:

Deploying to this repository

Please go into a specific package in this repository to see how to set up Maven to deploy artifacts to that package.

  1. In Maven’s setting.xml file, add the following section to declare your Bintray credentials. Use your API key as your password (not your login password, please!):

    <server>
    <id>bintray-user-package-package</id>
    <username>user</username>
    <password>**********</password>
    </server>
  2. Add the the following Distribution Management section to your project’s pom.xml file to tell Maven to deploy into this package using the credentials you configured in the previous step:

    <distributionManagement>
    <repository>
    <id>bintray-user-repo-package</id>
    <name>user-repo-package</name>
    <url>https://api.bintray.com/maven/user/repo/package</url>
    </repository>
    </distributionManagement>

手动部署

按照 How Do I Upload My Stuff to Bintray? 中所述准备 Artifact 文件夹

并使用这样的命令进行部署

mvn deploy:deploy-file -DpomFile=myfile-0.1.pom  -Dfile=myfile-0.1.jar -DrepositoryId=bintray -Durl=https://api.bintray.com/maven/user/repo/package

一般来说,使用 Maven 进行部署要容易得多

关于java - 如何加载/添加第三方jar文件到bitbucket?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21259479/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com