2017-09-28 11 views
1

私は追加のjarファイルをインポートしたいGitのレポで瓶に加え、MVNレポから依存関係をインポート

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

として持つのpom.xmlがあり、私が作成したGitのレポで私のファイルのための、本の瓶を持っています
https://mvnrepository.com/artifact/graphframes/graphframes/0.5.0-spark2.1-s_2.11

を私がポンポンファイルで作成する必要がどのような変更:次のように依存関係を持つMVNレポからgraphframes?依存関係の中

答えて

1

達人におけるリポジトリの3種類があります

1)ローカルレポジトリ:初めてで、中央またはリモートリポジトリからダウンロードしたjarファイルを格納するために使用されるローカル・システム上の場所と2からは時間の後ろの依存関係は、存在しない場合は最初にローカルリポジトリを検索し、次に中央のリポジトリに移動します:場所はMavenのsetting.xmlファイルで言及する必要があります。

2)中央リポジトリ:これはプロジェクトに関連するすべての依存関係を集中管理しており、その場所はsetting.xmlファイルで提供する必要があります。 私は、あなたがすでに "git repo"という設定ファイルをset.xmlファイルに書いておきたいと思います。

3)リモートリポジトリ:ローカルリポジトリまたは中央リポジトリに依存関係が存在しない場合でも、カスタムの場所を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). 
+0

それは中央リポジトリに検索し、ちょうどあなたがGitのレポを記載しているエラー –

+0

を与えるのgit repo.Henceで検索から終了されていませんか? – Punit

+0

すでに私の記事に言及していますが、1)settings.xmlファイルにgit repoを提供してください(既に提供されていれば、その依存関係をダウンロードできたのです)。 2)あなたのpomにgraphframes依存関係を提供し、リポジトリタグ内にもあなたのmvn repoの場所を提供します。 – Punit

0

では、次を挿入する必要がブロック:

<!-- 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 /インポートの変更でプロジェクトをリフレッシュします。

関連する問題