Download artifacts from a Nexus artifact repository. Only works with Mac and Linux
Nexus does really well with binary files. The idea is a repository can build and publish artifacts and other repositories can pull down those artifacts and extract them. Built files don't need to be committed to git, which take up most of the space in git repositories.
This plugin requires Grunt ~0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-nexus-artifact --save-dev
or add the following to your package.json file:
{
"devDependencies": {
"grunt-nexus-artifact": "0.1.1"
}
}
Once the plugin has been installed, enabled it inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-nexus-artifact');
Run this task with the grunt nexus
command.
nexus: {
client: {
url: 'http://nexus.google.com:8080',
repository: 'jslibraries',
fetch: [
{ id: 'com.google.js:jquery:tgz:1.8.0', path: 'public/lib/jquery' }
]
}
}
In grunt, options cascade. If all of your artifacts come from the same nexus server, you can do the following:
nexus: {
options: {
url: 'http://nexus.google.com:8080'
},
client: {
options: {
repository: 'jslibraries'
},
fetch: [
{ id: 'com.google.js:jquery:tgz:1.8.0', path: 'public/lib/jquery' }
]
},
build: {
options: {
repository: 'jstools'
},
fetch: [
{ id: 'com.google.js:closure:tgz:0.1.0', path: 'tools/closure' }
]
}
}
There are a number of options available.
Type: String
This defines the url of your nexus repository. This should be the base URL plus port. Ex: http://your-nexus-repository:8080
Type: String
This defines the name of the repository. Since this task uses the REST API, the repository is not inferred
Type: Array{Object}
This defines an array of nexus artifacts to be retrieved from nexus. Each artifact has config options:
Type: String
This defines the group_id of the artifact. Ex: com.google.js
Type: String
This defines the name of the artifact. Ex: jquery
Type: String
This defines the extension of the artifact. Ex: tgz
Type: String
This defines the version of the artifact. Ex: 1.8.0
Type: String
This is a shorthand for group_id
, name
, ext
and version
. This defines the id string of the artifact in the following format:
{group_id}:{name}:{ext}:{version}
Ex:
com.google.js:jquery:tgz:1.8.0
Type: String
This defines the path where the artifact will be extracted to. Ex: public/lib/jquery
Contributed by Nicholas Boll of Rally Software