当前位置: 首页 > 知识库问答 >
问题:

从mvn回购导入依赖除了git回购罐

劳麒
2023-03-14

我在我创建的git repo中为我的文件提供了JAR,该文件具有pom。xml作为

<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>
    <parent>
        <groupId>com.acc.ar</groupId>
        <artifactId>ar-anal-plat</artifactId>
        <version>1.6.0-RC-SNAPSHOT</version>
    </parent>
    <artifactId>gr-anal-app</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.acc.ar</groupId>
            <artifactId>ar-anal-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.acc.ar</groupId>
            <artifactId>ar-anal-core-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

我想从mvn repo中导入一个额外的jar图形框架,其依赖关系如下:
https://mvnrepository.com/artifact/graphframes/graphframes/0.5.0-spark2.1-s_2.11

我必须在pom文件中进行哪些更改?

共有2个答案

空谦
2023-03-14

在依赖块中,您需要插入以下内容:

   <!-- https://mvnrepository.com/artifact/graphframes/graphframes -->
   <dependency>
       <groupId>graphframes</groupId>
       <artifactId>graphframes</artifactId>
       <version>0.5.0-spark2.1-s_2.11</version>
   </dependency>

然后很可能在IDE/导入更改中刷新项目。

蔡弘扬
2023-03-14

maven中有3种类型的存储库:

1)本地存储库:本地系统上的一个位置,用于存储第一次从中央或远程存储库下载的jar,从第二次开始,依赖关系首先在本地存储库中搜索出来,如果不存在,则转到中央存储库:它的位置需要在maven的setting.xml文件中提及。

2) 中央存储库:它是所有与项目相关的依赖项的集中位置,需要在设置中提供它的位置。xml文件。我希望,您已经在设置中提到了“git回购”。xml文件。

3) 远程存储库:如果本地或中央repo中不存在任何依赖项,则可以在pom中提供自定义位置的依赖项。xml文件。因此,它将首先研究本地回购,如果不存在,则研究中央回购,然后研究远程回购。

<repositories>
  <repository>
     <id>companyname.lib1</id>
     <url>http://download.companyname.org/maven2/lib1</url>
  </repository>
  <repository>
     <id>companyname.lib2</id>
     <url>http://download.companyname.org/maven2/lib2</url>
  </repository>

在你的情况下使用这个,我想你的问题应该得到解决。

搜索顺序:

Step 1 − Search dependency in local repository, if not found, move to step 2 else perform the further processing.

Step 2 − Search dependency in central repository, if not found and remote repository/repositories is/are mentioned then move to step 4. Else it is downloaded to local repository for future reference.

Step 3 − If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency).

Step 4 − Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference. Otherwise, Maven stops processing and throws error (Unable to find dependency).
 类似资料:
  • 我从git和GitHub开始,我在GitHub上看了一个项目。我无意中点了一下叉子。现在它对我来说是一个新项目。 null 我想删除它。到目前为止,我只是在研究代码,并不真的需要叉子。

  • 我选择了[TimboKZ的Chonky],并对其进行了一些修改以适应我的项目。(链接:https://github.com/TimboKZ/Chonky)我遵循了这篇文章所说的每一步。当我运行npm I时,我的终端返回如下错误: 这就是我package.json的样子: 我应该怎么做才能成功地将分叉回购作为依赖项导入?我注意到TimboKZ在他的'包'文件夹中同时有'Chonky'和'Chonki

  • 我在bitbucket上创建了一个私人回购协议,并一直在推动我对其所做的更改,但我决定将其删除。 现在,每次我做出promise,我都会被提示推送,当然。。。 如何在SourceTree中更改/修复此问题,使我不会在本地SourceTree应用程序中获得提示和按钮图标(向上箭头)?

  • 我有本地回购。我创建了整个应用程序,但现在我想把它推到远程回购。我已经有远程回购以及。我怎样才能连接这两个回购而不失去任何工作,我已经做了?

  • 我已经复制了这个代码,似乎是各种工作dockerfile周围,这里是我的: 这给了我错误 这是我第一次使用dockerfile,但是从我所读到的(以及从工作配置中获取的),我不明白为什么这不起作用。 我的id_rsa和我的dockerfile在同一个文件夹中,是我的本地密钥的副本,可以克隆这个回购没有问题。 编辑: 在我的dockerfile中,我可以添加: 它打印出正确的密钥,所以我知道它被正确