Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cbuschka/maven-webpack-plugin
A webpack plugin that calls Maven (mvn, the Java build tool) to extract ${project.version}.
https://github.com/cbuschka/maven-webpack-plugin
maven npm version webpack
Last synced: about 2 months ago
JSON representation
A webpack plugin that calls Maven (mvn, the Java build tool) to extract ${project.version}.
- Host: GitHub
- URL: https://github.com/cbuschka/maven-webpack-plugin
- Owner: cbuschka
- License: apache-2.0
- Created: 2019-05-04T13:30:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-04T16:19:15.000Z (over 5 years ago)
- Last Synced: 2024-11-23T04:03:02.406Z (2 months ago)
- Topics: maven, npm, version, webpack
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/maven-webpack-plugin
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# maven-webpack-plugin
[![Build Status](https://travis-ci.org/cbuschka/maven-webpack-plugin.svg?branch=master)](https://travis-ci.org/cbuschka/maven-webpack-plugin)
[![npm version](https://badge.fury.io/js/maven-webpack-plugin.svg)](https://badge.fury.io/js/maven-webpack-plugin)
[![downloads](https://img.shields.io/npm/dm/maven-webpack-plugin.svg?style=flat-square)](https://www.npmjs.com/package/maven-webpack-plugin)### A [webpack](https://webpack.js.org/) plugin that calls [maven](https://maven.apache.org/) (the Java build tool) to extract ${project.version}.
## Requirements
- **webpack >= 4**## Installation
For npm:
```bash
npm install --save-dev maven-webpack-plugin
```For yarn;
```bash
yarn add -D maven-webpack-plugin
```## Usage
Load the plugin in your webpack config:
```javascript
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:
```javascript
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](https://webpack.js.org/plugins/define-plugin/#usage):
```javascript
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](https://github.com/cbuschka).[Apache License, Version 2.0](license)