Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
grunt-maven
Advanced tools
npm tasks for grunt-maven-plugin.
grunt-maven-plugin NPM tasks power Maven+Grunt integrated workflow. These tasks depend on properties file produced by grunt-maven-plugin, which contains paths and options derived from projects pom.xml.
Add plugin dependency to your package.json:
"devDependencies": {
"grunt-maven": "~1.1.0",
}
Load tasks in Gruntfile:
grunt.loadNpmTasks('grunt-maven');
This tasks role is to copy raw sources from Maven webapp sources to target-grunt
, where Grunt tasks will be executed.
In your project's Gruntfile, add a section named mavenPrepare
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
mavenPrepare: {
options: {
resources: ['**']
},
dev: {
},
prod: {
resources: ['**', '!dev/**']
}
},
});
Type: Array
List of patterns that will be evaluated using minimatch to choose resources that will be copied from Maven webapp to target-grunt.
mavenDist
task copies artifacts produced by Grunt (less -> css, minified JS) from target-grunt
to target-grunt/dist
and from target-grunt
to Maven WAR directory.
grunt.initConfig({
mavenDist: {
options: {
warName: 'war',
deliverables: ['**', '!non-deliverable.js'],
gruntDistDir: 'dist'
},
dev: {
warName: 'war-dev'
}
},
});
Type: String
Name of WAR directory, residing in /target/
, to which all deliverables will be copied.
Type: Array
List of patterns that will be evaluated using minimatch to choose deliverables that
will be copied from target-grunt/
to target-grunt/dist
and to WAR.
Type: String
Default: Directory where gruntfile is located
Deliverable patterns will be matched relative to this path, and all returned filepaths will also be relative to this path.
Type: String
Default: dist
Name of directory residing in target-grunt
, where all deliverables will be copied.
Each defined task that wants to operate on resources from Maven, should start with mavenPrepare
and end with mavenDist
,
for example:
grunt.registerTask('default', ['mavenPrepare', 'jshint', 'karma', 'less', 'uglify', 'mavenDist']);
target-grunt
target-grunt
Using grunt-contrib-watch
can be very useful to create good development environment, just register whatever task
you should need to run on resources change, using properties generated by grunt-maven-plugin to obtain watch path:
grunt.initConfig({
gruntMavenProperties: grunt.file.readJSON('grunt-maven.json'),
watch: {
maven: {
files: ['<%= gruntMavenProperties.filesToWatch %>'],
tasks: 'default'
}
}
});
gruntMavenProperties.filesToWatch
evaluates to /src/main/webapp/statics_dir/**
. If you need to exclude some resources from
being watched (although you probably shouldn't need to), use gruntMavenProperties.directoryToWatch
. This is simply path
to directory without globing pattern appended, in our case: /src/main/webapp/statics_dir
.
grunt-maven-plugin NPM tasks are published under Apache License 2.0.
FAQs
Grunt tasks for grunt-maven-plugin Maven+Grunt workflow.
We found that grunt-maven demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.