nexus-repo-3

package for interacting with Nexus Repository Manager (NXRM) 3.

Usage no npm install needed!

<script type="module">
  import nexusRepo3 from 'https://cdn.skypack.dev/nexus-repo-3';
</script>

README

nexus-repo-3

features

  • list repositories
  • retrieve nexus artifacts
  • supports username and password

overview

setup

git clone git@bitbucket.org:javapda/nexus-repo-3.git
cd nexus-repo-3
# after cloning from git run:
npm install

running it

node nexusRepo3Cli.js --retrieve-artifact com.gs:gs-util:8.0.10-SNAPSHOT:jar  --debug --list-repositories

example : get a list of repositories

var {nexusRepo3} = require('./src/nexusRepo3')

const config = {
  repoUrl:"https://some.domain.com/nexus",
  credentials:{username:"myusername",password:"mypassword"},
  commands:[{command:"list-repositories",args:null}]
};
nexusRepo3(config);

tool: nexusRepo3Cli.js

  • a command-line tool to simplify interactions with nexusRepo
// to see help and examples
node nexusRepo3Cli.js --help

config

Configuration is done through a json object.

{
  // `repoUrl` is the server URL where the nexus 3 repository exists (e.g. https://some.domain.com/nexus)
  repoUrl: 'https://some.domain.com/nexus',

  // `credentials` 
  credentials: { username:"my-nexus-username", password:"my-nexus-password"},

  // `commands` a list of commands and their arguments
  //commands: [{command:"<cmd>",args:["arg1","arg2",...,"argn"]}]
  commands: [{command:"list-repositories",args:null}],
  commands: [{command:"retrieve-gavs",args:["gav1","gav2",...,"gavn"]}]

}

gav formats

  • gav is short for the nexus coordinates of an artifact. But here, it has an expanded form. By default, extension is war. Best practice is to be explicit with the extension; otherwise, there may not be a .war version of the artifact and you will hit an error condition.
<groupId>:<artifactId>:<version>
<groupId>:<artifactId>:<version>:<extension>
  • So, if you wanted to get a jackson library artifact you would use gav of com.fasterxml.jackson.core:jackson-core:2.7.5:jar