2012-09-13 26 views
2

可能重複:
where do you put ivysettings.xml?如何螞蟻,用設置Ivy和Artifactory的工作文件

我已經設置了Artifactory的是在我的機器上本地運行:

http://localhost:8080/artifactory/myRepo 

該回購目前只有1個依賴它爲我管理,Google Guice(3.0):

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

我現在已經配置了我的Ant構建揭開序幕常春藤解決擺在最前頭:

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

我也寫一個ivy.xml描述我模塊。

什麼我掙扎是ivysettings.xml文件,具體爲:

  • 我在哪裏把它(我的文件系統上),還是Artifactory的「上傳」不知何故?如果是的話,在哪裏/如何?
  • 用戶名/密碼的東西(在<ivy:settings>任務中提供)用於基本HTTP身份驗證,並且I 假定 Artifactory會重用這些憑據?

基本上,我需要知道在哪裏放置設置文件,所有的登錄URL /憑據<ivy:settings>如何定義涉及到我的Artifactory的配置。

在此先感謝!

+0

謝謝@oers(+1) - 請在noamt的回答下看到我的評論 - 我對你有同樣的問題! – IAmYourFaja

回答

2

這部分是where do you put ivysettings.xml? 的重複關於認證 - Artifactory默認方案適用於基本的HTTP認證。

+0

感謝@noamt(+1) - 那麼你是說我應該把它放在'build.xml'的旁邊?我想我的掛斷來自兩件事情:(1)在某些時候,我需要提供一個用戶名/密碼來連接到Artifactory。我*認爲*它將通過''任務(因爲該任務已經具有'username','passwd'屬性等)。我對麼?如果沒有,那麼我應該在哪裏將我的Artifactory repo的憑證放在'resolver'定義中? (2)如果我有多個存儲庫需要連接到具有不同憑據的存儲庫,該怎麼辦? ''是不夠的... – IAmYourFaja

+0

@ 4herpsand7derpsago 1)是,通過憑證2)爲每個存儲庫定義憑證(主機屬性)。 – oers

+0

感謝@oers,但它看起來像只能爲'任務定義一個'host'屬性。你能用一個具體的例子來闡述一下嗎?再次感謝! – IAmYourFaja