如何使用Sonatype REST Api获取最高版本的构建(最新的临时构建)?
http://MY_REPOSITORY/nexus/service/local/lucene/search?a=ARTIFACT_NAME&v=ARTIFACT_VERSION将构建版本作为ARTIFACT_VERSION进行传递。传递v=LATEST或v=latest不会返回最新版本。
发布于 2013-02-10 23:50:40
未记录/service/local/lucene/search支持"LATEST“作为版本参数[link] OSS rest api文档声明/service/local/artifact/maven [link](https://oss.sonatype.org/nexus-restlet1x-plugin/default/docs/path__artifact_maven.html)和/service/local/artifact/maven/content [link](https://oss.sonatype.org/nexus-restlet1x-plugin/default/docs/path__artifact_maven_content.html)确实支持它:
版本的工件(必选)也支持最新版本、发布版本和快照版本(1.0-快照)的解析。
因此,我认为您应该使用其中之一(您还必须为它们提供repositoryId和groupId),例如:
http://MY_REPOSITORY/nexus/service/local/artifact/maven/content?r=repoId&g=groupName&a=art&v=LATEST发布于 2013-05-08 19:52:24
我遇到了同样的问题,并使用lucene搜索api像这样解决了它:
if [[ "${REPO}" == "snapshots" ]]; then
  version=$( curl --silent "http://${HOST}/nexus/service/local/lucene/search?g=${GROUP_ID}&a=${ARTIFACT}" | sed -n 's|<latestSnapshot>\(.*\)</latestSnapshot>|\1|p' | sed -e 's/^[ \t]*//' | tail -1 )
else
  version=$( curl --silent "http://${HOST}/nexus/service/local/lucene/search?g=${GROUP_ID}&a=${ARTIFACT}" | sed -n 's|<latestRelease>\(.*\)</latestRelease>|\1|p' | sed -e 's/^[ \t]*//' | tail -1 )
fi
curl -o ~/${ARTIFACT}-${VERSION}.zip -L -#  "http://${HOST}/nexus/service/local/artifact/maven/redirect?r=${REPO}&g=${GROUP_ID}&a=${ARTIFACT}&e=zip&v=${VERSION}"发布于 2013-09-25 07:39:20
Lucene搜索API还允许对版本进行关键字搜索:
http://<nexus_repository>/nexus/service/local/lucene/search?a=ARTIFACT_NAME&v=1.0.*https://stackoverflow.com/questions/14783859
复制相似问题