artifactory newbie

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

artifactory newbie

Dave Hoffer
I am trying to setup a maven proxy using artifactory; I have some
experience using proximity but none with artifactory.  What is the
recommended way to fully configure my maven settings.xml & artifactory's
config.xml.  I am having the same issues (plugin repo not found, getting
settings.xml right, etc) that I see in the newsgroups but there is no
posting that says what the fixes are.

I have added the following to my artifactory.config.xml:

<localRepositories>
      <localRepository>
    <key>local-repo</key>
    <description>Local releases</description>
    <handleReleases>true</handleReleases>
    <handleSnapshots>false</handleSnapshots>
  </localRepository>
  <localRepository>
    <key>local-snapshots</key>
    <description>Local snapshots</description>
    <handleReleases>false</handleReleases>
    <handleSnapshots>true</handleSnapshots>
  </localRepository>
</localRepositories>

Now I need to download artifacts from these plus all the public repos.
I also need to deploy and release to these repos using HTTP protocol.

How do I setup my settings.xml and/or pom.xml to do this?  With my
current attempts I do not get access to plugins.

Thanks!

-Dave


Reply | Threaded
Open this post in threaded view
|

Re: artifactory newbie

Thorsten Heit
Hello Dave,

> I am trying to setup a maven proxy using artifactory; I have some
> experience using proximity but none with artifactory.  What is the
> recommended way to fully configure my maven settings.xml & artifactory's
> config.xml.  I am having the same issues (plugin repo not found, getting
> settings.xml right, etc) that I see in the newsgroups but there is no
> posting that says what the fixes are.
>
> I have added the following to my artifactory.config.xml:
>
> <localRepositories>
>       <localRepository>
>     <key>local-repo</key>
>     <description>Local releases</description>
>     <handleReleases>true</handleReleases>
>     <handleSnapshots>false</handleSnapshots>
>   </localRepository>
>   <localRepository>
>     <key>local-snapshots</key>
>     <description>Local snapshots</description>
>     <handleReleases>false</handleReleases>
>     <handleSnapshots>true</handleSnapshots>
>   </localRepository>
> </localRepositories>
>
> Now I need to download artifacts from these plus all the public repos.
> I also need to deploy and release to these repos using HTTP protocol.
>
> How do I setup my settings.xml and/or pom.xml to do this?  With my
> current attempts I do not get access to plugins.


Example settings.xml:

<settings 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/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>my.releases</id>
      <username>username</username>
      <password>password</password>
    </server>

    <server>
      <id>my.snapshots</id>
      <username>username</username>
      <password>password</password>
    </server>
  </servers>

  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <repositories>
        <repository>
          <id>central</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </repository>

        <repository>
          <id>snapshots</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </repository>
      </repositories>

      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </pluginRepository>

        <pluginRepository>
          <id>snapshots</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>


A couple of days ago when I was trying out snapshot versions of some Maven plugins I have seen that some of them have their own repositories configured in their pom.xml. Result: When building my project using such a snapshot plugin, Maven tried to contact central mirror and ignored the proxy I have configured as above. In that case you should also configure the corresponding mirrors in your settings.xml:

  <mirrors>
    <mirror>
      <id>artifactory</id>
      <mirrorOf>apache.snapshots</mirrorOf> <!-- the id of the repository used in the pom.xml -->
      <url>http://<machine>:<port>/artifactory/repo</url>
      <name>Artifactory proxy</name>
    </mirror>
  </mirrors>

If you're using Maven 2.0.5, you can also use <mirrorOf>*</mirrorOf> instead of the above. In that case Maven will use that mirror for all configured repositories it tries to contact.


Finally add the following to your pom.xml:

<distributionManagement>
  <repository>
    <id>my.releases</id>
    <name>Releases</name>
    <url>http://<machine>:<port>/artifactory/local-repo@repo</url>
  </repository>

  <snapshotRepository>
    <id>my.snapshots</id>
    <name>Snapshots</name>
    <url>http://<machine>:<port>/artifactory/local-snapshots@repo</url>
  </snapshotRepository>
</distributionManagement>

Then your Maven installation should play fine with Artifactory :-)


HTH

Thorsten


Reply | Threaded
Open this post in threaded view
|

Re: artifactory newbie

Yoav Landman
Administrator
Thanks for the <mirrorOf>*</mirrorOf> tip.
We'll add it to the docs.

On 3/22/07, Thorsten Heit <[hidden email]> wrote:
Hello Dave,

> I am trying to setup a maven proxy using artifactory; I have some
> experience using proximity but none with artifactory.  What is the
> recommended way to fully configure my maven settings.xml & artifactory's
> config.xml.  I am having the same issues (plugin repo not found, getting
> settings.xml right, etc) that I see in the newsgroups but there is no
> posting that says what the fixes are.
>
> I have added the following to my artifactory.config.xml:
>
> <localRepositories>
>       <localRepository>
>               <key>local-repo</key>
>               <description>Local releases</description>
>               <handleReleases>true</handleReleases>
>               <handleSnapshots>false</handleSnapshots>
>       </localRepository>
>       <localRepository>
>               <key>local-snapshots</key>
>               <description>Local snapshots</description>
>               <handleReleases>false</handleReleases>
>               <handleSnapshots>true</handleSnapshots>
>       </localRepository>
> </localRepositories>
>
> Now I need to download artifacts from these plus all the public repos.
> I also need to deploy and release to these repos using HTTP protocol.
>
> How do I setup my settings.xml and/or pom.xml to do this?  With my
> current attempts I do not get access to plugins.


Example settings.xml:

<settings 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/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>my.releases </id>
      <username>username</username>
      <password>password</password>
    </server>

    <server>
      <id>my.snapshots</id>
      <username>username</username>
      <password>password</password>
    </server>
  </servers>

  <profiles>
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <repositories>
        <repository>
          <id>central</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </repository>

        <repository>
          <id>snapshots</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </repository>
      </repositories>

      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </pluginRepository>

        <pluginRepository>
          <id>snapshots</id>
          <url>http://<machine>:<port>/artifactory/repo</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>


A couple of days ago when I was trying out snapshot versions of some Maven plugins I have seen that some of them have their own repositories configured in their pom.xml. Result: When building my project using such a snapshot plugin, Maven tried to contact central mirror and ignored the proxy I have configured as above. In that case you should also configure the corresponding mirrors in your settings.xml:

  <mirrors>
    <mirror>
      <id>artifactory</id>
      <mirrorOf>apache.snapshots</mirrorOf> <!-- the id of the repository used in the pom.xml -->
      <url>http://<machine>:<port>/artifactory/repo</url>
      <name>Artifactory proxy</name>
    </mirror>
  </mirrors>

If you're using Maven 2.0.5 , you can also use <mirrorOf>*</mirrorOf> instead of the above. In that case Maven will use that mirror for all configured repositories it tries to contact.


Finally add the following to your pom.xml :

<distributionManagement>
  <repository>
    <id>my.releases</id>
    <name>Releases</name>
    <url>http://<machine>:<port>/artifactory/local-repo@repo </url>
  </repository>

  <snapshotRepository>
    <id>my.snapshots</id>
    <name>Snapshots</name>
    <url>http://<machine>:<port>/artifactory/local- snapshots@repo</url>
  </snapshotRepository>
</distributionManagement>

Then your Maven installation should play fine with Artifactory :-)


HTH

Thorsten

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Artifactory-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/artifactory-users
Reply | Threaded
Open this post in threaded view
|

Re: artifactory newbie

Thorsten Heit
> Thanks for the <mirrorOf>*</mirrorOf> tip.
> We'll add it to the docs.

AFAIK this is new since Maven 2.0.5 (there were some discussions  
about this on the mailing list some time ago).


Thorsten

PGP.sig (201 bytes) Download Attachment