【问题标题】:ivy:listmodule does not find an existing moduleivy:listmodule 未找到现有模块
【发布时间】:2014-08-29 09:33:20
【问题描述】:

我们的共享 Ivy 存储库位于可在我们的 Intranet 中访问的 nginx Web 服务器上。 我配置了一个 url 解析器从共享存储库中读取,并配置了一个 ssh 解析器来写入它,主要遵循 Jason Grimes 出色的 blog post on managing dependencies in non-Java projects

现在我刚刚通过ssh 解析器成功地将一个模块发布到存储库。 在我的 SFTP 客户端中,我可以看到 Web 服务器提供的目录中的目录结构和文件:

com.organization/modulename/ivy-modulename-2.0.1.xml.md5
com.organization/modulename/ivy-modulename-2.0.1.xml.sha1
com.organization/modulename/ivy-modulename-2.0.1.xml
com.organization/modulename/modulename-2.0.1.zip.md5
com.organization/modulename/modulename-2.0.1.zip.sha1
com.organization/modulename/modulename-2.0.1.zip

但是,当我执行ivy:listmodule 时,它似乎没有找到它。坦率地说,除了ivysettings 初始化输出之外,它不会输出任何内容。

这是我正在执行的 Ant 目标:

<!-- ================================
     target: check-already-in-repo

     Check if the current version of a module already exists in the (shared) repository.
     ================================ -->
<target name="check-already-in-repo">
    <ivy:listmodules resolver="shared" organisation="${ivy.organisation}" module="${ivy.module}" revision="${version}" property="already-in-repo" value="true"/>

    <ac:if>
        <isset property="already-in-repo"/>
        <then>
            <echo>${ivy.module} ${version} already exists in the repository.</echo>
            <echo>Skipping publishing of ${ivy.module}.</echo>
        </then>
    </ac:if>
</target>

这是唯一的输出:

$ ant check-already-in-repo -Dversion=2.0.1 -Divy.organisation=com.organization -Divy.module=modulename
Buildfile: [...]/build.xml

check-already-in-repo:
[ivy:listmodules] :: Apache Ivy 2.4.0-rc1 - 20140315220245 :: http://ant.apache.org/ivy/ ::
[ivy:listmodules] :: loading settings :: file = [...]/build/ivysettings.xml

BUILD SUCCESSFUL
Total time: 0 seconds

我检查了ivy.shared.default.root 的值以及对应的 ivy 和 artifact 模式,它们都匹配(我保持简单)。

我尝试使用 glob 匹配器并使用 organization=*module=*revision=* 调用 ivy:listmodules,所以它应该在任何情况下都返回 something。它没有。

我错过了什么?

以下是相关配置的其余部分:

<ivysettings>

    <!-- This file is referenced from multiple projects - DO NOT EDIT! -->

    <!-- shared -->
    <property name="ivy.shared.default.root" value="http://10.79.1.30/ivy"/>
    <property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/ivy-[module]-[revision].[ext]"/>
    <property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[artifact]-[revision].[ext]"/>

    <!-- local -->
    <property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local"/>
    <property name="ivy.local.default.ivy.pattern" value="${ivy.shared.default.ivy.pattern}"/>
    <property name="ivy.local.default.artifact.pattern" value="${ivy.shared.default.artifact.pattern}"/>

    <settings defaultResolver="default"/>
    <resolvers>
        <filesystem name="local">
            <ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
            <artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
        </filesystem>
        <!-- read access -->
        <url name="shared">
            <ivy pattern="${ivy.shared.default.root}/${ivy.shared.default.ivy.pattern}" />
            <artifact pattern="${ivy.shared.default.root}/${ivy.shared.default.artifact.pattern}" />
        </url>
        <!-- write access -->
        <ssh name="ssh" host="10.79.1.30" port="22" user="ivy" userPassword="${ivy.ssh.password}" publishPermissions="0664">
            <ivy pattern="${ivy.shared.default.ivy.pattern}" />
            <artifact pattern="${ivy.shared.default.artifact.pattern}" />
        </ssh>
        <chain name="default" returnFirst="true">
            <resolver ref="local"/>
            <resolver ref="shared"/>
        </chain>
    </resolvers>
</ivysettings>

【问题讨论】:

    标签: ant ivy


    【解决方案1】:

    在使用 -d(调试)选项执行 Ant 目标后,一些东西引起了我的注意:

    $ ant check-already-in-repo -Dversion=2.0.1 -Divy.organisation=com.organization -Divy.module=modulename -d
    [...]
    [ivy:listmodules]   using shared to list all in http://10.79.1.30/ivy/
    [ivy:listmodules] HTTP response status: 403 url=http://10.79.1.30/ivy/
    [ivy:listmodules] CLIENT ERROR: Forbidden url=http://10.79.1.30/ivy/
    [ivy:listmodules] HTTP response status: 403 url=http://10.79.1.30/ivy/
    [ivy:listmodules] CLIENT ERROR: Forbidden url=http://10.79.1.30/ivy/
    [ivy:listmodules] problem while listing resources in http://10.79.1.30/ivy/ with shared (java.io.IOException: The HTTP response code for http://10.79.1.30/ivy/ did not indicate a success. See log for more detail.)
    [ivy:listmodules] java.io.IOException: The HTTP response code for http://10.79.1.30/ivy/ did not indicate a success. See log for more detail.
    [...]
    

    似乎要让listmodules 工作,网络服务器需要启用目录列表。确实,在添加之后

    location /ivy {
        autoindex on;
    }
    

    到 nginx 配置并重新启动 Web 服务器,它终于按预期工作了!

    $ ant check-already-in-repo -Dversion=2.0.1 -Divy.organisation=com.organization -Divy.module=modulename
    Buildfile: [...]/build.xml
    
    check-already-in-repo:
    [ivy:listmodules] :: Apache Ivy 2.4.0-rc1 - 20140315220245 :: http://ant.apache.org/ivy/ ::
    [ivy:listmodules] :: loading settings :: file = [...]/build/ivysettings.xml
         [echo] modulename 2.0.1 already exists in the repository.
         [echo] Skipping publishing of modulename.
    
    BUILD SUCCESSFUL
    Total time: 0 seconds
    

    万岁! :-)

    【讨论】:

      猜你喜欢
      • 2018-02-19
      • 2018-04-15
      • 2020-09-28
      • 2019-09-11
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      • 2019-09-23
      相关资源
      最近更新 更多