npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-maven-deploy

v0.2.1

Published

Grunt Maven Deploy

Downloads

725

Readme

grunt-maven-deploy

Grunt Maven Deploy

Getting Started

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:

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:

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

The "maven_deploy" task

The project is heavily based off of 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().

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)

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.

Usage Examples

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

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: ''}]
    },
  },
});