2016-05-20 14 views
1

Artifactoryセットアップがあり、Artifactoryに自動的にキャッシュされるアーティファクトのダウンロードにはMaven central repoを使用します。 Artifactoryに独自のアーティファクトをアップロード/展開します。アーティファクトをダウンロードするためのjcenterと、アーティファクトを配置するためのArtifactory

私は今jcenterで Mavenの中央リポジトリを交換し、私たち自身のアーティファクトを展開/アップロードするためともjcenter(およびサードパーティ)アーティファクトをキャッシュするため、当社のArtifactoryを引き続き使用したいにしたいです。すべての開発者に、settings.xmlファイルを変更するように依頼することができます。これは1回限りの作業で問題ありません。

設定ファイルの<repositories><pluginRepositories>セクションの変更を記述した@helmedeirosによるリンクthisを見ました。しかし、それらはArtifactoryサーバのURLを指定するセクションです。私がArtifactory URLを置き換えると、jcenterからアーティファクトをフェッチしてアップロードすることができますが、これは私が望むものではありません。

すべての開発者がであることを確認するにはどうすればいいですか?は、jcenterから(デプロイ/アップロードしないで)Artifactoryにのみ展開/アップロードできますか?

は、ここでは、settings.xml内の今持っているものです。

<?xml version="1.0" encoding="UTF-8"?> 
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <servers> 
    <server> 
     <username>${security.getCurrentUsername()}</username> 
     <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password> 
     <id>central</id> 
    </server> 
    <server> 
     <username>${security.getCurrentUsername()}</username> 
     <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password> 
     <id>snapshots</id> 
    </server> 
    </servers> 
    <profiles> 
    <profile> 
     <repositories> 
     <repository> 
      <snapshots> 
      <enabled>false</enabled> 
      </snapshots> 
      <id>central</id> 
      <name>libs-release</name> 
      <url>https://inhouse-artifactory/artifactory/libs-release</url> 
     </repository> 
     <repository> 
      <snapshots /> 
      <id>snapshots</id> 
      <name>libs-snapshot</name> 
      <url>https://inhouse-artifactory/artifactory/libs-snapshot</url> 
     </repository> 
     </repositories> 
     <pluginRepositories> 
     <pluginRepository> 
      <snapshots> 
      <enabled>false</enabled> 
      </snapshots> 
      <id>central</id> 
      <name>plugins-release</name> 
      <url>https://inhouse-artifactory/artifactory/plugins-release</url> 
     </pluginRepository> 
     <pluginRepository> 
      <snapshots /> 
      <id>snapshots</id> 
      <name>plugins-snapshot</name> 
      <url>https://inhouse-artifactory/artifactory/plugins-snapshot</url> 
     </pluginRepository> 
     </pluginRepositories> 
     <id>artifactory</id> 
    </profile> 
    </profiles> 
    <activeProfiles> 
    <activeProfile>artifactory</activeProfile> 
    </activeProfiles> 
</settings> 

は、私は本当にこの点で任意の助けに感謝します。

+0

@JBaruch:この問題に関して親切にお手伝いできますか? – Technext

答えて

0

私は正確に同じ質問:)

私のソリューションは、公共の成果物のほとんどをキャッシュするArtifactory仮想リポジトリ(forgerock-サードパーティの仮想)を作成することですがあります。

この仮想リポジトリがjcenterに基づいてリモートリポジトリ含まれています:仮想リポジトリで

enter image description here

を、デフォルトの展開リポジトリはありません。したがって、この設定で

enter image description here

、私は開発者がこの仮想リポジトリをプッシュできないことを願っています。

JFrog documentationによれば、このドロップダウンで1つのリポジトリを選択して、仮想リポジトリにプッシュできるようになっています。

デプロイメントの設定に関しては、<distributionManagement>セクションに独自のリポジトリを指定した親のpomもあります。私のビルドマシンで

、私はアーティファクトをキャッシュする(.m2/settings.xml内)このプロファイルを追加しました:

<profile> 
    <id>force-third-party-repo</id> 
    <activation> 
    <activeByDefault>true</activeByDefault> 
    </activation> 
    <repositories> 
    <repository> 
     <id>forgerock-third-party</id> 
     <name>ForgeRock Third Party Repository</name> 
     <url>http://maven.forgerock.org/repo/forgerock-third-party-virtual</url> 
     <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
     <releases> 
     <enabled>true</enabled> 
     </releases> 
    </repository> 
    </repositories> 
    <pluginRepositories> 
    <pluginRepository> 
     <id>forgerock-third-party</id> 
     <name>ForgeRock Third Party Repository</name> 
     <url>http://maven.forgerock.org/repo/forgerock-third-party-virtual</url> 
     <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
     <releases> 
     <enabled>true</enabled> 
     </releases> 
    </pluginRepository> 
    </pluginRepositories> 
</profile> 

私は(私たち自身のArtifactoryリポジトリを宣言するために、このファイルの他の設定を持っています私たち自身の成果物をプッシュ/プルするため)+いくつかのMaven資格情報

私はMavenプロジェクトの1つでいくつかのテストを行いましたが、うまくいきました。

新しい.m2 /設定が完了しました。xmlが準備されたら、内部のArtifactoryリポジトリでテンプレートをプッシュして、開発者はこのテンプレートをcurlコマンドで取得できるようになります。

FYI、これは現時点ではPOCです。我々は数日でこれらの設定でプロダクションに移りたいと思っています。

+0

私は新しい仮想リポジトリを設定するというあなたの動機を実際には得られませんでした。フェッチに関する限り、jcenterを 'Virtual> remote-repos'セクションに一番上に置いておくと、jcenter-cacheに自動的にキャッシュされます。これは、Maven中心の代わりに_jcenter_からフェッチするという私の懸念を解決します。 _jcenter_への展開を防ぐために、私は 'Default Deployment Repository'を空白にしておけば、問題の一部しか解決できないと思います。誰かがsettings.xmlファイルのデフォルトのデプロイメントパスとして_jcenter_を指定するとどうなりますか? – Technext

+0

私の仮想リポジトリは、複数のリモート+ 1つのローカルリポジトリの集合体です。 1つのエントリポイント(仮想リポジトリ)を使用することで、settings.xmlに関連するクレデンシャルを1回だけ設定できます。配備の問題については、Artifactory権限メカニズムを使用して解決できますか?ユーザーの読み取りアクセスのみを設定できます。デプロイメントからレポを保護するためには、その作業を行う必要があります。 –

+0

私はあなたが言っていると思うものである[this](https://www.jfrog.com/blog/push-the-limits-of-virtual-repositories-2/)の記事を見ていました。私が間違っている場合は私を修正してください。私が正しいとすれば、ローカルスナップショットリポジトリとローカルリリースリポジトリの両方にデプロイする目的が、どのように_single_ URLに与えられているのでしょうか?アーティファクトがどこに配備されるかをどのように区別することができますか? ''セクションでArtifactory URLを指定し、 'libs-snapshot-local'または' libs-release-local'を追加しますが、この場合はわかりません。 – Technext

関連する問題