Skip to content

Instantly share code, notes, and snippets.

@lwiechec
Forked from fs111/gist:3097209
Created August 24, 2012 13:28
Show Gist options
  • Save lwiechec/3450531 to your computer and use it in GitHub Desktop.
Save lwiechec/3450531 to your computer and use it in GitHub Desktop.
nexus commandline search
#!/bin/bash
# command line search script for nexus instances. Needs curl and xmlstarlet
# installed.
NEXUS_URL="http://nexus.example.com/nexus/service/local/lucene/search?q="
# make sure we got exactly one param
if [ ! $# -eq 1 ]
then
echo "usage nexus-search <term>"
exit 1
fi
curl -s $NEXUS_URL$1 | xmlstarlet sel -T -t -m /searchNGResponse/data/artifact \
-v "groupId" -o " "\
-v "artifactId" -o " " \
-v "version" -n
#!/usr/bin/awk -f
# simple AWK script to be used with nexus-search script to convert the results
# into maven-compatible dependency statements
{ printf("<dependency>\n <groupId>%s</groupId>\n <artefactId>%s</artefactId>\n <version>%s</version>\n</dependency>\n\n", $1, $2, $3) }
@lwiechec
Copy link
Author

usage: nexus-search | maven-deps.awk

@alfredodiaz
Copy link

I think that it does not work with Nexus v3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment