简体   繁体   English

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

[英]How to load/add third party jar files to bitbucket?

I want to load some jar file that are not present in maven repository or any other such repository.我想加载一些在 Maven 存储库或任何其他此类存储库中不存在的 jar 文件。

For that I have created a repository named as "maven-repo" on bitbucket and cloned it to my local machine.为此,我在 bitbucket 上创建了一个名为“maven-repo”的存储库,并将其克隆到我的本地机器上。

Now I am using command现在我正在使用命令

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 mvn install:install-file -DgroupId=groupid -DartifactId=myid -Dversion=5.1 -Dfile=/文件路径/filename.jar -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=./repository -DcreateChecksum=true

After that I push that folder/repository to bitbucket server.之后,我将该文件夹/存储库推送到 bitbucket 服务器。 Now I want to add it to my maven project's pom.xml.现在我想将它添加到我的 maven 项目的 pom.xml 中。

I added like:我补充说:

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

But it gives me error failed to load a jar.但它给我错误加载 jar 失败。

How to include a jar file and import classes in project???如何在项目中包含 jar 文件和导入类???

Deploying with Maven使用 Maven 部署

From official documentation (I cannot link, this is a popup)来自官方文档(我无法链接,这是一个弹出窗口)

Bintray adds a new layer to traditional Maven repositories in the form of a package. Bintray 以包的形式为传统的 Maven 存储库添加了一个新层。 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.包充当管理有关项目及其版本的元数据的容器,并且可能包含具有不同组 ID 的工件集合。

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.请进入此存储库中的特定包,以了解如何设置 Maven 以将工件部署到该包。

  1. In Maven's setting.xml file, add the following section to declare your Bintray credentials.在 Maven 的 setting.xml 文件中,添加以下部分以声明您的 Bintray 凭据。 Use your API key as your password (not your login password, please!):使用您的 API 密钥作为您的密码(请不要使用您的登录密码!):

     <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:将以下 Distribution Management 部分添加到您项目的 pom.xml 文件中,以告诉 Maven 使用您在上一步中配置的凭据部署到此包中:

     <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>

Manual deploy手动部署

Prepare artifact folder as is described in How Do I Upload My Stuff to Bintray?按照如何将我的东西上传到 Bintray 中所述准备工件文件夹

And deploy using commannd like this并像这样使用命令进行部署

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

In general deploying with maven is much easier一般来说,使用 maven 部署要容易得多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM