Nexus Artifact Deployer from grunt
To install
npm install nexus-deployer --save-dev
From there, you have options
- Run with Node
- Run with Gulp
- Run with Grunt
var deployer = require('nexus-deployer');
var release = {
groupId: 'nexus-deployer',
artifactId: 'nexus-deployer',
version: '1.0',
packaging: 'zip',
auth: {
username:'admin',
password:'admin123'
},
pomDir: 'build/pom',
url: 'http://localhost:8081/nexus/content/repositories/releases',
artifact: 'build/nexus-deployer.zip',
noproxy: 'localhost',
cwd: ''
};
deployer.deploy(release, function(){
// your async call back here
// done();
});
var deployer = require('nexus-deployer');
// dont forget to create a task to actually generate the artifact as assumed
// here with the dependent 'artifacts:generate' task
gulp.task('deploy:artifacts', ['artifacts:generate'], function(callback) {
var snapshot = {
groupId: 'nexus-deployer',
artifactId: 'nexus-deployer',
version: '1.2-SNAPSHOT',
packaging: 'zip',
auth: {
username:'admin',
password:'admin123'
},
pomDir: 'build/pom',
url: 'http://localhost:8081/nexus/content/repositories/snapshots',
artifact: 'build/nexus-deployer.zip',
noproxy: 'localhost',
cwd: '',
quiet: false,
insecure: true
};
deployer.deploy(snapshot, callback);
});
This plugin requires Grunt ~0.4.2
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:
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('nexus-deployer');
In your project's Gruntfile, add a section named nexusDeployer
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
nexusDeployer: {
release: {
options: {
groupId: "nexus-deployer",
artifactId: "nexus-deployer",
version: "1.0",
packaging: 'zip',
classifier: 'dev',
auth: {
username:'admin',
password:'admin123'
},
pomDir: 'build/pom',
url: 'http://localhost:9220/nexus/content/repositories/releases',
artifact: 'build/nexus-deployer.zip',
noproxy: 'localhost',
cwd: ''
}
}
}
});
Type: String
Default value: ''
The group owning the artifact.
Type: String
Default value: ''
The artifact id of the artifact.
Type: String
Default value: ''
Type of artifact. eg zip, jar, pom, war etc.
Type: String
Defaut value: ''
An optional classifier that can further distinguish between artifacts of the same group, id and version. eg dev, prod etc. (i.e. artifact-1.0-dev.zip, artifact-1.0-prod.zip)
Type: String
Default value: ''
Version of the artifact being uploaded. Ensure you have your versions ending with -SNAPSHOT when an artifact is being uploaded to snapshot repository. Often artifact repositories have that restriction.
Type: String
Default value: ''
Password to be used for authentication against nexus server
Type: String
Default value: ''
Username to be used for authentication against nexus server
Type: boolean
Default value: false
Accept Self-Signed certificates when connecting over https.
Type: String
Default value: ''
Nexus repository url. Usually /nexus/content/repositories/snapshots or /nexus/content/repositories/releases
Type: String
Default value: ''
Artifact to be uploaded. Must be a file.
Type: String
Default value: '127.0.0.1'
list of comma separated addresses to exclude for which proxy is not applicable. This is a must when running proxy and HTTP_PROXY environment value is set.
Type: String
Default value: ''
working directory from which deployer will deploy artifacts.
Type: Boolean
Default value: 'false'
Whether to upload artifacts in parallel.
Type: Boolean
Default value: 'false'
Chatty flag.
Deploy to release repository
grunt.initConfig({
nexusDeployer: {
release: {
options: {
groupId: "nexus-deployer",
artifactId: "nexus-deployer",
version: "1.0",
packaging: 'zip',
auth: {
username:'admin',
password:'admin123'
},
pomDir: 'build/pom',
url: 'http://localhost:8081/nexus/content/repositories/releases',
artifact: 'build/nexus-deployer.zip',
noproxy: 'localhost',
cwd: ''
}
}
}
});
Deploy to snapshots repository
grunt.initConfig({
nexusDeployer: {
release: {
options: {
groupId: "nexus-deployer",
artifactId: "nexus-deployer",
version: "1.0-SNAPSHOT",
packaging: 'zip',
auth: {
username:'admin',
password:'admin123'
},
pomDir: 'build/pom',
url: 'http://localhost:8081/nexus/content/repositories/snapshots',
artifact: 'build/nexus-deployer.zip',
noproxy: 'localhost',
cwd: '',
parallel:false,
quiet: true
}
}
}
});
To run
grunt nexusDeployer