# grunt-maven-deploy

> Grunt Maven Deploy

Latest version **0.2.1** (published 2014-12-08) · 0 weekly downloads

## Install

```sh
npm install grunt-maven-deploy
pnpm add grunt-maven-deploy
yarn add grunt-maven-deploy
bun add grunt-maven-deploy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2014-12-08 |
| First published | 2013-12-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | mrkelly |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/grunt-maven-deploy
- Repository: https://mrkelly@github.com/mrkelly/grunt-maven-deploy
- Homepage: https://github.com/mrkelly/grunt-maven-deploy
- Issues: https://github.com/mrkelly/grunt-maven-deploy/issues
- npm.io page: https://npm.io/package/grunt-maven-deploy

## Dependencies (2)

- [grunt](https://npm.io/package/grunt.md) ~0.4.2
- [grunt-contrib-compress](https://npm.io/package/grunt-contrib-compress.md) ~0.5.3

## Recent versions

- 0.2.1 (latest) — 2014-12-08
- 0.2.0 — 2014-04-10
- 0.1.3 — 2014-02-21
- 0.1.2 — 2014-01-28
- 0.1.1 — 2013-12-06

## README

# grunt-maven-deploy

> Grunt Maven Deploy

## Getting Started
This plugin requires Grunt `~0.4.2`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-maven-deploy --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-maven-deploy');
```

## The "maven_deploy" task

The project is heavily based off of [grunt-maven-tasks](https://github.com/smh/grunt-maven-tasks) by Stein Martin Hustad.  This plugin is a slimmed down version whose sole purpose is to publish artifacts to an artifact repository with classifiers.  All versioning and releasing should be managed by the user. 

### Overview
In your project's Gruntfile, add a section named `maven_deploy` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
  options: {
    groupId: 'com.github.mrkelly',
    artifactId: 'grunt-maven-deploy',        
  },
  src: {
    options: {
      url: '<%= repositoryURL %>',
      repositoryId: 'my-nexus',
      classifier: 'sources'
    },
    files: [{src: ['**'], dest: ''}]
  },
});
```

### Options

#### options.groupId
Type: `String`
Required

The maven group id to use when deploying and artifact

#### options.artifactId
Type: `String`
Default: name found in package.json

The maven artifact id to use when deploying and artifact

#### options.packaging
Type: `String`
Default: `zip`

The artifact packaging. Supported values are `jar`, `war`, `gzip`, `deflate`, `deflateRaw`, `tar`, `tgz` (tar gzip), and `zip`.

If `options.type` is defined, that parameter is used instead.

#### options.type *(deprecated)*
Type: `String`
Optional

This parameter overrides the `options.packaging` parameter.

#### options.classifier
Type: `String`
Optional

The artifact classifier.

#### options.version
Type: `String`
Default: version found in package.json

The version to use when deploying to the maven repository

#### options.snapshot
Type: `Boolean`
Default: `false`

If true, `-SNAPSHOT` is appended to the version.

#### options.file
Type: `String` | `Function`
Default: *artifactId-version.packaging*
Example: fizzwidget-1.0.0.war

The output file.  You can use either a string or a callback function which takes an `options` parameter.  The `options` parameter includes all the options for this target's configuration.  

Note that `options.version` will have `-SNAPSHOT` appended at the time the file function is invoked when options.snapshot is `true`.

Example)

```javascript
function(options) {
  // customize output directory name and filename
  return 'target/' + options.artifactId + '-' + options.version + '.' + options.packaging;
}
```

#### options.goal
Type: `String`
Default: `deploy`

The action used to deploy the artifact. Supported values are `deploy` or `install`.

#### options.url
Type: `String`
Required when `options.goal` is `deploy` (the default). Ignored otherwise.

The url for the maven repository to deploy to.

#### options.repositoryId
Type: `String`
Optional. Ignored if `options.goal` is not `deploy`.

The repository id of the repository to deploy to. Used for looking up authentication in settings.xml.

### options.injectDestFolder
Type: `String`
Optional

Enables you to turn off the injection of destination folder inside your artifact allowing you to choose the structure you want by configuring the compress task.

### Files

Files may be specified using any of the supported [Grunt file mapping formats](http://gruntjs.com/configuring-tasks#files).

### Usage Examples

Deploying snapshots for source and dist as well as releases for source and dist.

```js
grunt.initConfig({
  maven_deploy: {
    options: {
      groupId: 'com.github.mrkelly',
      artifactId: 'grunt-maven-deploy',        
    },
    'release-src': {
      options: {
        url: '<%= releaseRepository %>',
        repositoryId: 'my-nexus',
        classifier: 'sources'
      },
      files: [{src: ['**'], dest: ''}]
    },
    'release-dist': {
      options: {
        url: '<%= releaseRepository %>',
        repositoryId: 'my-nexus',
      },
      files: [{expand: true, cwd: 'tasks/', src: ['**'], dest: ''}]
    },
    'deploy-src': {
      options: {
        url: '<%= snapshotRepository %>',
        repositoryId: 'my-nexus',
        classifier: 'sources'
      },
      files: [{src: ['**'], dest: ''}]
    },
    'deploy-dist': {
      options: {
        url: '<%= snapshotRepository %>',
        repositoryId: 'my-nexus',
      },
      files: [{expand: true, cwd: 'tasks/', src: ['**'], dest: ''}]
    },
  },
});
```

---
_Source: https://npm.io/package/grunt-maven-deploy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
