我正在尝试验证从 Nexus 下载的工件的校验和。我可以抓取该工件并下载它们并检查它们的 md5sum 或 sha1sum,但我需要根据 Nexus 的实际总和进行检查,以便我可以验证它们是否正确。
这是我用来从 Nexus 获取文件的命令:
curl -v -L -o /mylocation/artifact.war -u 'myuser:mypass' --get 'http://ournexus.com/service/local/artifact/maven/content?g=com.ours.stuff&a=our-service-war&v=LATEST&r=snapshots&p=war'
Via http://nexus.xwiki.org/nexus/nexus-indexer-lucene-plugin/default/docs/path__lucene_search.html,看来我也可以搜索 sha1 sum,但是当我执行 &sha1 时,我没有得到任何额外的内容或 sha1=(sum),即使我省略了上述所有选项,也没有任何内容被拉起。
这可行,但它涉及一场特定的战争,我们需要最新的(显然):
http://ournexus.com/service/local/repositories/snapshots/content/com/ours/stuff/ourapp/1.0.0-SNAPSHOT/ourapp-1.0.0-20140730.173704-88.war.sha1
这可能吗?我走在正确的轨道上吗?
您可以直接获取文件,也可以使用 Nexus API 以编程方式检索文件。
以下网址:
http://localhost:8081/nexus/service/local/artifact/maven/resolve?g=log4j&a=log4j&v=1.2.9&r=central
返回以下结果:
<artifact-resolution>
<data>
<presentLocally>true</presentLocally>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
<extension>jar</extension>
<snapshot>false</snapshot>
<snapshotBuildNumber>0</snapshotBuildNumber>
<snapshotTimeStamp>0</snapshotTimeStamp>
<sha1>55856d711ab8b88f8c7b04fd85ff1643ffbfde7c</sha1>
<repositoryPath>/log4j/log4j/1.2.9/log4j-1.2.9.jar</repositoryPath>
</data>
</artifact-resolution>
xmllint 命令可用于解析 sha1 校验和值,如下所示:
$ curl -s "http://localhost:8081/nexus/service/local/artifact/maven/resolve?g=log4j&a=log4j&v=1.2.9&r=central" | xmllint --xpath "///sha1/text()" -
55856d711ab8b88f8c7b04fd85ff1643ffbfde7c
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)