IvySettings.xml 文件在构建期间未被 Ant 读取。

huangapple go评论66阅读模式
英文:

IvySettings.xml file is not read by Ant during build

问题

我想要从我的内部仓库下载我的Ant项目中的所有依赖项/ JAR文件(在Netbeans上运行)。

  1. 我已经安装了Ivy JAR,并将其放置在我的Apache Ant的lib文件夹中。

  2. 我已经将ivysettings.xml文件放置在我的根文件夹中(也就是我有build.xml文件的地方)。

2.i. 我的ivysettings.xml文件如下:

<ivysettings>
    <properties file="${ivy.settings.dir}/ivysettings-file.properties"/>
    <settings defaultResolver="https://my-internal-repo.com/artifactory"/>
    <caches defaultCacheDir="${cache.dir}" checkUpToDate="false"/>
    <credentials host="https://my-internal-repo.com/artifactory" realm="Artifactory Realm" username="usrname" passwd="ABCD"/>
    <resolvers>
        <url name="https://my-internal-repo.com/artifactory">
            <ivy pattern="https://my-internal-repo.com/artifactory/webapp/#/artifacts/browse/tree/General/Maven-JCentral-cache/org/apache/ivy/ivy/2.2.0/ivy-2.2.0-sources.jar"/>
            <artifact pattern="https://my-internal-repo.com/npm-remote-cache/mongodb/-/mongodb-3.1.13.tgz"/>
        </url>
        <filesystem name="internal">
            <ivy pattern="${repository.dir}"/>
            <artifact pattern="${repository.dir}"/>
        </filesystem>
    </resolvers>
    <modules>
        <module organisation="com.myOrg.*" name=".*" resolver="internal"/>
    </modules>
</ivysettings>

2.ii. 我的ivysettings-file.properties文件如下:

ivy.settings.dir=C:\Users\Documents\NetBeansProjects\ANTProject\JavaApplication1,
cache.dir=C:\Users\Downloads\IVYCache,
repository.dir=C:\Users\Downloads\repodir

2.iii. 我的build.xml文件如下:

  1. 我已经在系统的环境变量中添加了IVY_HOME。

  2. 现在,当我从命令行输入"ant"命令时,从我的根文件夹(也就是我有build.xml文件的地方)执行构建成功,但在构建日志中,我看不到关于Ivy的任何信息。我认为它没有读取我的ivy设置。我应该如何修复它,并且我如何验证我的ivysettings.xml是否被读取,因为我必须限制Netbeans从我的内部仓库下载所有依赖项。

英文:

I want to download all dependencies/jars in my Ant project (Running on Netbeans) from my internal repository.

  1. I have installed ivy jar and placed it in my Apache ant's lib folder.
    IvySettings.xml 文件在构建期间未被 Ant 读取。

  2. I have kept ivysettings.xml in my root folder (where I have my build.xml)
    IvySettings.xml 文件在构建期间未被 Ant 读取。

2.i. My ivysettings.xml file is:

&lt;ivysettings&gt;
    &lt;properties file=&quot;${ivy.settings.dir}/ivysettings-file.properties&quot;/&gt;
    &lt;settings defaultResolver=&quot;https://my-internal-repo.com/artifactory&quot;/&gt;
    &lt;caches  defaultCacheDir=&quot;${cache.dir}&quot; checkUpToDate=&quot;false&quot;/&gt;
	&lt;credentials host=&quot;https://my-internal-repo.com/artifactory&quot; realm=&quot;Artifactory Realm&quot; username=&quot;usrname&quot; passwd=&quot;ABCD&quot;/&gt;
    &lt;resolvers&gt;
			&lt;url name=&quot;https://my-internal-repo.com/artifactory&quot;&gt;
			&lt;ivy pattern=&quot;https://my-internal-repo.com/artifactory/webapp/#/artifacts/browse/tree/General/Maven-JCentral-cache/org/apache/ivy/ivy/2.2.0/ivy-2.2.0-sources.jar&quot;/&gt;
			&lt;artifact pattern=&quot;https://my-internal-repo.com/npm-remote-cache/mongodb/-/mongodb-3.1.13.tgz&quot;/&gt;
			&lt;/url&gt;
            &lt;filesystem name=&quot;internal&quot;&gt;
                    &lt;ivy pattern=&quot;${repository.dir}&quot;/&gt;
                    &lt;artifact pattern=&quot;${repository.dir}&quot;/&gt;
            &lt;/filesystem&gt;
    &lt;/resolvers&gt;
    &lt;modules&gt;
            &lt;module organisation=&quot;com.myOrg.*&quot; name=&quot;.*&quot; resolver=&quot;internal&quot;/&gt;
    &lt;/modules&gt;

</ivysettings>

2.ii. My ivysettings-file.properties is:<br/>
ivy.settings.dir=C:\Users\Documents\NetBeansProjects\ANTProject\JavaApplication1,<br/>
cache.dir=C:\Users\Downloads\IVYCache,<br/>
repository.dir=C:\Users\Downloads\repodir<br/>

2.iii. My build.xml file is:
IvySettings.xml 文件在构建期间未被 Ant 读取。

  1. I have added IVY_HOME in my system's env variable:
    IvySettings.xml 文件在构建期间未被 Ant 读取。

  2. Now when I am entering command "ant" from my root folder (where I have my build.xml) from cmd the build is successful but I cant see a word about Ivy on cmd in build logs. I think its not reading my ivy settings. how can I fix it and how will I verify that my ivysettings.xml is read bcoz I have to restrict my netbeans to download all dependencies from my-internal-repository.

Please do let me know what else I am missing ?

答案1

得分: 2

你的 ivy-2.2.0-sources.jar 可能只包含了 Ivy 的源代码,而没有编译后的类文件,你或者 Ant 可能需要尝试下载 ivy-2.2.0.jar。

英文:

your ivy-2.2.0-sources.jar might only contain the sources of ivy not the compiled classes you or ant would need, try to download ivy-2.2.0.jar.

huangapple
  • 本文由 发表于 2020年8月4日 18:59:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/63245443.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定