2

Possible Duplicate:
where do you put ivysettings.xml?

I have set up Artifactory to be running locally on my machine at:

http://localhost:8080/artifactory/myRepo

That repo currently has only 1 dependency it is managing for me, Google Guice (3.0):

myRepo/
    google/
        guice/
            3.0/
                guice-3.0/
                    guice-3.0.jar
                    guive-3.0-ivy.xml

I have now configured my Ant build to kick off an Ivy resolve right up front:

<project name="myapp-build default="audit" basedir=".." xmlns:ivy="antlib:org.apache.ivy.ant">
    <path id="ant.lib.path">
        <fileset dir="${env.ANT_HOME}/lib" includes="*.jar"/>
    </path>

    <!-- I have ivy.jar and its dependencies installed under ${ANT_HOME}lib. -->
    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ant.lib.path"/>
    <target name="resolve">
        <!-- Initialize Ivy and connect to host repository. -->
        <echo message="Initializing Apache Ivy and connecting to the host repository."/>
        <ivy:settings url="${ivy.std.repo.settings.url}" realm="${ivy.std.repo.realm}"
username="${ivy.std.repo.username}" passwd="${ivy.std.repo.password}"/>

        <!-- Clear/flush the Ivy cache. -->
        <echo message="Cleaning the local Ivy cache for the current build."/>
        <ivy:cleancache/>

        <!-- Resolve ivy.xml against the standard repository (all configurations) -->
        <echo message="Resolving ivy.xml dependencies against the host repository."/>
        <ivy:resolve file="./ivy.xml"/>

        <!-- Retrieve compile dependencies from local Ivy cache and place them into the gen/lib/main. -->
        <echo message="Retrieving compile-time dependencies."/>
        <ivy:retrieve ivypattern="${gen.lib.main.dir}/[artifact].[ext]" conf="compile"/>

        <!-- Retrieve test dependencies from local Ivy cache and place them into the gen/lib/test. -->
        <echo message="Retrieving testing dependencies."/>
        <ivy:retrieve ivypattern="${gen.lib.test.dir}/[artifact].[ext]" conf="test"/>
    </target>

...

</project>

I've also written an ivy.xml descriptor for my module.

What I am struggling with is the ivysettings.xml file, specifically:

  • Where do I put it (on my file system), or does Artifactory "upload" it somehow? If so, where/how?
  • The username/password stuff (provided in the <ivy:settings> task) is for basic HTTP authentication, and I assume Artifactory reuses these credentials?

Basically, I need to know where to put the settings file, and how all the login URLs/credentials defined in <ivy:settings> relates to my Artifactory config.

Thanks in advance!

Community
  • 1
  • 1
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756

1 Answers1

2

This is partially a duplicate of where do you put ivysettings.xml? In regard to authentication - Artifactory default scheme works with basic HTTP authentication.

Community
  • 1
  • 1
noamt
  • 7,397
  • 2
  • 37
  • 59
  • Thanks @noamt (+1) - so are you saying that I should put it right next to `build.xml`? I guess my hangup comes from two things: (1) At some point I need to provide a username/password to connect to Artifactory. I *thought* that it would be via the `` task (since that task already has `username`, `passwd` attributes, etc.). Am I correct? If not, then where do I place my Artifactory repo's credentials...in the `resolver` definition perhaps? (2) What if I have multiple repositories that I need to connect to that have different credentials? `` would not be sufficient... – IAmYourFaja Sep 14 '12 at 11:46
  • @4herpsand7derpsago 1) yes, via credentials 2)define a credential for each repository (host attribute). – oers Sep 14 '12 at 11:53
  • Thanks @oers but it looks like you can have only one `host` attribute defined for the `` task. Can you elaborate with a concrete example? Thanks again! – IAmYourFaja Sep 14 '12 at 12:10
  • @4herpsand7derpsago its not really documented, but did you try with 2 credentials? I would find it awkard if that wouldn't work – oers Sep 14 '12 at 14:14