1.0.0 • Published 5 years ago

maven-webpack-plugin v1.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
5 years ago

maven-webpack-plugin

A webpack plugin that calls mvn (Java build tool).

Requirements

  • webpack >= 4

Installation

For npm:

npm install --save-dev maven-webpack-plugin

For yarn;

yarn add -D maven-webpack-plugin

Usage

Load the plugin in your webpack config:

const MavenWebpackPlugin = require('maven-webpack-plugin')

module.exports = {
  plugins: [
    new MavenWebpackPlugin()
  ]
}

The plugin replaces [maven-project-version] with the ${project.version} from pom.xml.

Example:

module.exports = {
  output: {
    publicPath: 'http://example.com/[maven-project-version]/',
    filename: '[name]-[maven-project-version].js'
  }
}

Plugin API

The ${project.version} is exposed via public API.

Example using the DefinePlugin:

const webpack = require('webpack')
const MavenWebpackPlugin = require('maven-webpack-plugin')
const mavenWebpackPlugin = new MavenWebpackPlugin()

module.exports = {
  plugins: [
    mavenWebpackPlugin,
    new webpack.DefinePlugin({
      'VERSION': JSON.stringify(mavenWebpackPlugin.projectVersion())
    })
  ]
}

License

Copyright (c) 2019 by Cornelius Buschka.

Apache License, Version 2.0