我们在内部网中可以访问的nginx Web服务器上拥有共享的Ivy存储库。
我配置了一个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
的值以及相应的常春藤和工件模式,并且它们都匹配(我保持简单)。
我尝试使用glob
匹配器并使用ivy:listmodules
,organization=*
和module=*
调用revision=*
,因此它应该在每种情况下都返回东西。它没有。
我想念什么?
以下是相关配置的其余部分:
<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>
答案 0 :(得分:0)
使用-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
万岁! : - )