Fork me on GitHub

minify:minify

Full name:

com.samaxes.maven:minify-maven-plugin:1.7.6:minify

Description:

Goal for combining and minifying CSS and JavaScript files.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: process-resources.

Optional Parameters

Name Type Since Description
bufferSize int - Size of the buffer used to read source files.
Default value is: 4096.
User property is: bufferSize.
bundleConfiguration String - Specify aggregations in an external JSON formatted config file.
User property is: bundleConfiguration.
charset String - If a supported character set is specified, it will be used to read the input file. Otherwise, it will assume that the platform's default character set is being used. The output file is encoded using the same character set.
See the IANA Charset Registry for a list of valid encoding types.
Default value is: ${project.build.sourceEncoding}.
User property is: charset.
closureAngularPass boolean - Generate $inject properties for AngularJS for functions annotated with @ngInject.
Default value is: false.
User property is: closureAngularPass.
closureCompilationLevel CompilationLevel - The degree of compression and optimization to apply to your JavaScript.
There are three possible compilation levels:
  • WHITESPACE_ONLY: Just removes whitespace and comments from your JavaScript.
  • SIMPLE_OPTIMIZATIONS: Performs compression and optimization that does not interfere with the interaction between the compiled JavaScript and other JavaScript. This level renames only local variables.
  • ADVANCED_OPTIMIZATIONS: Achieves the highest level of compression by renaming symbols in your JavaScript. When using ADVANCED_OPTIMIZATIONS compilation you must perform extra steps to preserve references to external symbols. See Advanced Compilation and Externs for more information about ADVANCED_OPTIMIZATIONS.

Default value is: SIMPLE_OPTIMIZATIONS.
User property is: closureCompilationLevel.
closureCreateSourceMap boolean - Collects information mapping the generated (compiled) source back to its original source for debugging purposes.
Please visit Source Map Revision 3 Proposal for more information.
Default value is: false.
User property is: closureCreateSourceMap.
closureDefine HashMap - Override the value of variables annotated with @define.
The format is:

<define>
    <name>value</name>
</define>

where <name> is the name of a @define variable and value is a boolean, number or string.
User property is: closureDefine.
closureEnvironment CompilerOptions$Environment - Determines the set of builtin externs to load.
Options: BROWSER, CUSTOM.
Default value is: BROWSER.
User property is: closureEnvironment.
closureExterns ArrayList - List of JavaScript files containing code that declares function names or other symbols. Use closureExterns to preserve symbols that are defined outside of the code you are compiling. The closureExterns parameter only has an effect if you are using a CompilationLevel of ADVANCED_OPTIMIZATIONS.
These file names are relative to webappSourceDir directory.
User property is: closureExterns.
closureExtraAnnotations ArrayList - A whitelist of tag names in JSDoc. Needed to support JSDoc extensions like ngdoc.
User property is: closureExtraAnnotations.
closureLanguageIn CompilerOptions$LanguageMode - Refers to which version of ECMAScript to assume when checking for errors in your code.
Possible values are:
  • ECMASCRIPT3: Checks code assuming ECMAScript 3 compliance, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5: Checks code assuming ECMAScript 5 compliance, allowing new features not present in ECMAScript 3, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5_STRICT: Like ECMASCRIPT5 but assumes compliance with strict mode ('use strict';).
  • ECMASCRIPT6: Checks code assuming ECMAScript 6 compliance, allowing new features not present in ECMAScript 5.
  • ECMASCRIPT6_STRICT: Like ECMASCRIPT6 but assumes compliance with strict mode ('use strict';).

Default value is: ECMASCRIPT6.
User property is: closureLanguageIn.
closureLanguageOut CompilerOptions$LanguageMode - Refers to which version of ECMAScript your code will be returned in.
It accepts the same options as closureLanguageIn and is used to transpile between different levels of ECMAScript.
Default value is: ECMASCRIPT5.
User property is: closureLanguageOut.
closureSortDependencies boolean - Enables or disables sorting mode for Closure Library dependencies.
If true, automatically sort dependencies so that a file that goog.provides symbol X will always come before a file that goog.requires symbol X.
Default value is: false.
User property is: closureSortDependencies.
closureWarningLevels HashMap - Treat certain warnings as the specified CheckLevel:
  • ERROR: Makes all warnings of the given group to build-breaking error.
  • WARNING: Makes all warnings of the given group a non-breaking warning.
  • OFF: Silences all warnings of the given group.
Example:

<closureWarningLevels>
    <nonStandardJsDocs>OFF</nonStandardJsDocs>
</closureWarningLevels>

For the complete list of diagnostic groups please visit https://github.com/google/closure-compiler/wiki/Warnings.
User property is: closureWarningLevels.
cssEngine MinifyMojo$Engine - Define the CSS compressor engine to use.
Possible values are:
Default value is: YUI.
User property is: cssEngine.
cssFinalFile String - CSS output file name.
Default value is: style.css.
User property is: cssFinalFile.
cssSourceDir String - CSS source directory.
Default value is: css.
User property is: cssSourceDir.
cssSourceExcludes ArrayList - CSS files to exclude. Specified as fileset patterns which are relative to the CSS source directory.
User property is: cssSourceExcludes.
Alias is: cssExcludes.
cssSourceFiles ArrayList - CSS source file names list.
User property is: cssSourceFiles.
Alias is: cssFiles.
cssSourceIncludes ArrayList - CSS files to include. Specified as fileset patterns which are relative to the CSS source directory.
User property is: cssSourceIncludes.
Alias is: cssIncludes.
cssTargetDir String - CSS target directory. Takes the same value as cssSourceDir when empty.
User property is: cssTargetDir.
debug Boolean - Deprecated. Use verbose instead.
User property is: debug.
disableOptimizations Boolean - Deprecated. Use yuiDisableOptimizations instead.
User property is: disableOptimizations.
jsEngine MinifyMojo$Engine - Define the JavaScript compressor engine to use.
Possible values are:
Default value is: YUI.
User property is: jsEngine.
jsFinalFile String - JavaScript output file name.
Default value is: script.js.
User property is: jsFinalFile.
jsSourceDir String - JavaScript source directory.
Default value is: js.
User property is: jsSourceDir.
jsSourceExcludes ArrayList - JavaScript files to exclude. Specified as fileset patterns which are relative to the JavaScript source directory.
User property is: jsSourceExcludes.
Alias is: jsExcludes.
jsSourceFiles ArrayList - JavaScript source file names list.
User property is: jsSourceFiles.
Alias is: jsFiles.
jsSourceIncludes ArrayList - JavaScript files to include. Specified as fileset patterns which are relative to the JavaScript source directory.
User property is: jsSourceIncludes.
Alias is: jsIncludes.
jsTargetDir String - JavaScript target directory. Takes the same value as jsSourceDir when empty.
User property is: jsTargetDir.
linebreak Integer - Deprecated. Use yuiLineBreak instead.
User property is: linebreak.
munge Boolean - Deprecated. Use yuiNoMunge instead.
User property is: munge.
nosuffix boolean - Do not append a suffix to the minified output file name, independently of the value in the suffix parameter.
Warning: when both the options nosuffix and skipMerge are set to true, the plugin execution phase needs to be set to package, otherwise the output files will be overridden by the source files during the packaging.
Default value is: false.
User property is: nosuffix.
preserveAllSemiColons Boolean - Deprecated. Use yuiPreserveSemicolons instead.
User property is: preserveAllSemiColons.
skipMerge boolean - Skip the merge step. Minification will be applied to each source file individually.
Default value is: false.
User property is: skipMerge.
skipMinify boolean - Skip the minify step. Useful when merging files that are already minified.
Default value is: false.
User property is: skipMinify.
suffix String - The output file name suffix.
Default value is: .min.
User property is: suffix.
verbose boolean - Display additional informational messages and warnings.
Default value is: false.
User property is: verbose.
webappSourceDir String - Webapp source directory.
Default value is: ${basedir}/src/main/webapp.
User property is: webappSourceDir.
webappTargetDir String - Webapp target directory.
Default value is: ${project.build.directory}/${project.build.finalName}.
User property is: webappTargetDir.
yuiDisableOptimizations boolean - Disable all the built-in micro-optimizations.
Default value is: false.
User property is: yuiDisableOptimizations.
yuiLineBreak int - Some source control tools don't like files containing lines longer than, say 8000 characters. The line-break option is used in that case to split long lines after a specific column. It can also be used to make the code more readable and easier to debug. Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS. Specify -1 to disallow line breaks.
Default value is: -1.
User property is: yuiLineBreak.
yuiNoMunge boolean - Minify only. Do not obfuscate local symbols.
Default value is: false.
User property is: yuiNoMunge.
yuiPreserveSemicolons boolean - Preserve unnecessary semicolons (such as right before a '}'). This option is useful when compressed code has to be run through JSLint.
Default value is: false.
User property is: yuiPreserveSemicolons.

Parameter Details

bufferSize:

Size of the buffer used to read source files.
  • Type: int
  • Required: No
  • User Property: bufferSize
  • Default: 4096

bundleConfiguration:

Specify aggregations in an external JSON formatted config file.
  • Type: java.lang.String
  • Required: No
  • User Property: bundleConfiguration

charset:

If a supported character set is specified, it will be used to read the input file. Otherwise, it will assume that the platform's default character set is being used. The output file is encoded using the same character set.
See the IANA Charset Registry for a list of valid encoding types.
  • Type: java.lang.String
  • Required: No
  • User Property: charset
  • Default: ${project.build.sourceEncoding}

closureAngularPass:

Generate $inject properties for AngularJS for functions annotated with @ngInject.
  • Type: boolean
  • Required: No
  • User Property: closureAngularPass
  • Default: false

closureCompilationLevel:

The degree of compression and optimization to apply to your JavaScript.
There are three possible compilation levels:
  • WHITESPACE_ONLY: Just removes whitespace and comments from your JavaScript.
  • SIMPLE_OPTIMIZATIONS: Performs compression and optimization that does not interfere with the interaction between the compiled JavaScript and other JavaScript. This level renames only local variables.
  • ADVANCED_OPTIMIZATIONS: Achieves the highest level of compression by renaming symbols in your JavaScript. When using ADVANCED_OPTIMIZATIONS compilation you must perform extra steps to preserve references to external symbols. See Advanced Compilation and Externs for more information about ADVANCED_OPTIMIZATIONS.
  • Type: com.google.javascript.jscomp.CompilationLevel
  • Required: No
  • User Property: closureCompilationLevel
  • Default: SIMPLE_OPTIMIZATIONS

closureCreateSourceMap:

Collects information mapping the generated (compiled) source back to its original source for debugging purposes.
Please visit Source Map Revision 3 Proposal for more information.
  • Type: boolean
  • Required: No
  • User Property: closureCreateSourceMap
  • Default: false

closureDefine:

Override the value of variables annotated with @define.
The format is:

<define>
    <name>value</name>
</define>

where <name> is the name of a @define variable and value is a boolean, number or string.
  • Type: java.util.HashMap
  • Required: No
  • User Property: closureDefine

closureEnvironment:

Determines the set of builtin externs to load.
Options: BROWSER, CUSTOM.
  • Type: com.google.javascript.jscomp.CompilerOptions$Environment
  • Required: No
  • User Property: closureEnvironment
  • Default: BROWSER

closureExterns:

List of JavaScript files containing code that declares function names or other symbols. Use closureExterns to preserve symbols that are defined outside of the code you are compiling. The closureExterns parameter only has an effect if you are using a CompilationLevel of ADVANCED_OPTIMIZATIONS.
These file names are relative to webappSourceDir directory.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: closureExterns

closureExtraAnnotations:

A whitelist of tag names in JSDoc. Needed to support JSDoc extensions like ngdoc.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: closureExtraAnnotations

closureLanguageIn:

Refers to which version of ECMAScript to assume when checking for errors in your code.
Possible values are:
  • ECMASCRIPT3: Checks code assuming ECMAScript 3 compliance, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5: Checks code assuming ECMAScript 5 compliance, allowing new features not present in ECMAScript 3, and gives errors for code using features only present in later versions of ECMAScript.
  • ECMASCRIPT5_STRICT: Like ECMASCRIPT5 but assumes compliance with strict mode ('use strict';).
  • ECMASCRIPT6: Checks code assuming ECMAScript 6 compliance, allowing new features not present in ECMAScript 5.
  • ECMASCRIPT6_STRICT: Like ECMASCRIPT6 but assumes compliance with strict mode ('use strict';).
  • Type: com.google.javascript.jscomp.CompilerOptions$LanguageMode
  • Required: No
  • User Property: closureLanguageIn
  • Default: ECMASCRIPT6

closureLanguageOut:

Refers to which version of ECMAScript your code will be returned in.
It accepts the same options as closureLanguageIn and is used to transpile between different levels of ECMAScript.
  • Type: com.google.javascript.jscomp.CompilerOptions$LanguageMode
  • Required: No
  • User Property: closureLanguageOut
  • Default: ECMASCRIPT5

closureSortDependencies:

Enables or disables sorting mode for Closure Library dependencies.
If true, automatically sort dependencies so that a file that goog.provides symbol X will always come before a file that goog.requires symbol X.
  • Type: boolean
  • Required: No
  • User Property: closureSortDependencies
  • Default: false

closureWarningLevels:

Treat certain warnings as the specified CheckLevel:
  • ERROR: Makes all warnings of the given group to build-breaking error.
  • WARNING: Makes all warnings of the given group a non-breaking warning.
  • OFF: Silences all warnings of the given group.
Example:

<closureWarningLevels>
    <nonStandardJsDocs>OFF</nonStandardJsDocs>
</closureWarningLevels>

For the complete list of diagnostic groups please visit https://github.com/google/closure-compiler/wiki/Warnings.
  • Type: java.util.HashMap
  • Required: No
  • User Property: closureWarningLevels

cssEngine:

Define the CSS compressor engine to use.
Possible values are:
  • Type: com.samaxes.maven.minify.plugin.MinifyMojo$Engine
  • Required: No
  • User Property: cssEngine
  • Default: YUI

cssFinalFile:

CSS output file name.
  • Type: java.lang.String
  • Required: No
  • User Property: cssFinalFile
  • Default: style.css

cssSourceDir:

CSS source directory.
  • Type: java.lang.String
  • Required: No
  • User Property: cssSourceDir
  • Default: css

cssSourceExcludes:

CSS files to exclude. Specified as fileset patterns which are relative to the CSS source directory.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: cssSourceExcludes
  • Alias: cssExcludes

cssSourceFiles:

CSS source file names list.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: cssSourceFiles
  • Alias: cssFiles

cssSourceIncludes:

CSS files to include. Specified as fileset patterns which are relative to the CSS source directory.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: cssSourceIncludes
  • Alias: cssIncludes

cssTargetDir:

CSS target directory. Takes the same value as cssSourceDir when empty.
  • Type: java.lang.String
  • Required: No
  • User Property: cssTargetDir

debug:

Deprecated. Use verbose instead.
Show source file paths in log output.
  • Type: java.lang.Boolean
  • Required: No
  • User Property: debug

disableOptimizations:

Deprecated. Use yuiDisableOptimizations instead.
Disable all the built-in micro-optimizations.
  • Type: java.lang.Boolean
  • Required: No
  • User Property: disableOptimizations

jsEngine:

Define the JavaScript compressor engine to use.
Possible values are:
  • Type: com.samaxes.maven.minify.plugin.MinifyMojo$Engine
  • Required: No
  • User Property: jsEngine
  • Default: YUI

jsFinalFile:

JavaScript output file name.
  • Type: java.lang.String
  • Required: No
  • User Property: jsFinalFile
  • Default: script.js

jsSourceDir:

JavaScript source directory.
  • Type: java.lang.String
  • Required: No
  • User Property: jsSourceDir
  • Default: js

jsSourceExcludes:

JavaScript files to exclude. Specified as fileset patterns which are relative to the JavaScript source directory.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: jsSourceExcludes
  • Alias: jsExcludes

jsSourceFiles:

JavaScript source file names list.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: jsSourceFiles
  • Alias: jsFiles

jsSourceIncludes:

JavaScript files to include. Specified as fileset patterns which are relative to the JavaScript source directory.
  • Type: java.util.ArrayList
  • Required: No
  • User Property: jsSourceIncludes
  • Alias: jsIncludes

jsTargetDir:

JavaScript target directory. Takes the same value as jsSourceDir when empty.
  • Type: java.lang.String
  • Required: No
  • User Property: jsTargetDir

linebreak:

Deprecated. Use yuiLineBreak instead.
Some source control tools don't like files containing lines longer than, say 8000 characters. The line-break option is used in that case to split long lines after a specific column. It can also be used to make the code more readable and easier to debug. Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS. Specify -1 to disallow line breaks.
  • Type: java.lang.Integer
  • Required: No
  • User Property: linebreak

munge:

Deprecated. Use yuiNoMunge instead.
Obfuscate local symbols in addition to minification.
  • Type: java.lang.Boolean
  • Required: No
  • User Property: munge

nosuffix:

Do not append a suffix to the minified output file name, independently of the value in the suffix parameter.
Warning: when both the options nosuffix and skipMerge are set to true, the plugin execution phase needs to be set to package, otherwise the output files will be overridden by the source files during the packaging.
  • Type: boolean
  • Required: No
  • User Property: nosuffix
  • Default: false

preserveAllSemiColons:

Deprecated. Use yuiPreserveSemicolons instead.
Preserve unnecessary semicolons (such as right before a '}'). This option is useful when compressed code has to be run through JSLint.
  • Type: java.lang.Boolean
  • Required: No
  • User Property: preserveAllSemiColons

skipMerge:

Skip the merge step. Minification will be applied to each source file individually.
  • Type: boolean
  • Required: No
  • User Property: skipMerge
  • Default: false

skipMinify:

Skip the minify step. Useful when merging files that are already minified.
  • Type: boolean
  • Required: No
  • User Property: skipMinify
  • Default: false

suffix:

The output file name suffix.
  • Type: java.lang.String
  • Required: No
  • User Property: suffix
  • Default: .min

verbose:

Display additional informational messages and warnings.
  • Type: boolean
  • Required: No
  • User Property: verbose
  • Default: false

webappSourceDir:

Webapp source directory.
  • Type: java.lang.String
  • Required: No
  • User Property: webappSourceDir
  • Default: ${basedir}/src/main/webapp

webappTargetDir:

Webapp target directory.
  • Type: java.lang.String
  • Required: No
  • User Property: webappTargetDir
  • Default: ${project.build.directory}/${project.build.finalName}

yuiDisableOptimizations:

Disable all the built-in micro-optimizations.
  • Type: boolean
  • Required: No
  • User Property: yuiDisableOptimizations
  • Default: false

yuiLineBreak:

Some source control tools don't like files containing lines longer than, say 8000 characters. The line-break option is used in that case to split long lines after a specific column. It can also be used to make the code more readable and easier to debug. Specify 0 to get a line break after each semi-colon in JavaScript, and after each rule in CSS. Specify -1 to disallow line breaks.
  • Type: int
  • Required: No
  • User Property: yuiLineBreak
  • Default: -1

yuiNoMunge:

Minify only. Do not obfuscate local symbols.
  • Type: boolean
  • Required: No
  • User Property: yuiNoMunge
  • Default: false

yuiPreserveSemicolons:

Preserve unnecessary semicolons (such as right before a '}'). This option is useful when compressed code has to be run through JSLint.
  • Type: boolean
  • Required: No
  • User Property: yuiPreserveSemicolons
  • Default: false