java - Ant、Ivy 和 Artifactory 如何使用设置文件

标签 java ant ivy artifactory

Possible Duplicate:
where do you put ivysettings.xml?

我已将 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 构建来立即启动 Ivy 解析:

<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 身份验证,我假设 Artifactory 会重复使用这些凭据?

基本上,我需要知道将设置文件放在哪里,以及如何在 <ivy:settings> 中定义所有登录 URL/凭据。与我的 Artifactory 配置有关。

提前致谢!

最佳答案

这与 where do you put ivysettings.xml? 部分重复。 关于身份验证 - Artifactory 默认方案适用于基本 HTTP 身份验证。

关于java - Ant、Ivy 和 Artifactory 如何使用设置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12412192/

相关文章:

scala - 为什么sbt每次清理后都运行依赖解析?

java - 没有得到预期的输出

java regex/arraylist问题,无法获取匹配/arraylist存储新值

java调用eclipse的ant API

java - 如何从项目内部获取并使用 Apache Ivy.jar 文件,而不将其放在 .ant 文件夹中?

ant - 使用 Ivy 下载/安装 ant-contrib、bsf、beanshell、commons-logging

java - Java 字符串中的字符 "æ", "ø" "æ"(Windows)

java - 回复 : Convert Double to byte[] array

eclipse ant 构建失败无法删除文件 lib\build

java - 使用 ant/ivy 运行构建时出现 Selenium 远程 webdriver 错误