DEV Community

taijidude
taijidude

Posted on

Get help for a maven plugin

Today i was fighting to get a vaadin app building again with maven. During my search for documentation of the vaadin maven plugin i came across this neat little trick. You can get maven to print out help goal descriptions for you with the following command

mvn help:describe -Dplugin=vaadin
Enter fullscreen mode Exit fullscreen mode

The result:

...
Name: Vaadin Maven plugin
Description: Vaadin Platform
Group Id: com.vaadin
Artifact Id: vaadin-maven-plugin
Version: 14.8.0
Goal Prefix: vaadin

This plugin has 8 goals:

vaadin:build-frontend
  Description: Goal that builds the frontend bundle. It performs the
    following actions when creating a package:
    - Update Constants.PACKAGE_JSON file with the NpmPackage annotations
      defined in the classpath,
    - Copy resource files used by flow from `.jar` files to the `node_modules`
      folder
    - Install dependencies by running npm install
    - Update the FrontendUtils.IMPORTS_NAME file imports with the JsModule
      Theme and JavaScript annotations defined in the classpath,
    - Update FrontendUtils.WEBPACK_CONFIG file.

vaadin:clean-frontend
  Description: Goal that cleans the frontend files to a clean state.
    Deletes Vaadin dependencies from package.json, the generated frontend
    folder and the npm/pnpm-related files and folders:

    - node_modules
    - pnpm-lock.yaml
    - package-lock.json

vaadin:copy-production-files
  Description: Goal that copies all production mode files into the
    CopyProductionFilesMojo.copyOutputDirectory directory. Files are copied
    from CopyProductionFilesMojo.frontendWorkingDirectory directory, WebJars
    and regular jars, refer to ProductionModeCopyStep for details.

vaadin:dance
  Description: This is the hidden `vaadin:dance` to clean up the frontend
    files.

vaadin:migrate-to-p3
  Description: This goal migrates project from compatibility mode to NPM
    mode.

vaadin:package-for-production
  Description: Goal that prepares all web files from
    PackageForProductionMojo.transpileEs6SourceDirectory for production mode:
    minifies, transpiles and bundles them.

vaadin:prepare-frontend
  Description: This goal checks that node and npm tools are installed, copies
    frontend resources available inside `.jar` dependencies to `node_modules`,
    and creates or updates `package.json` and `webpack.config.json` files.

vaadin:validate
  Description: This goal checks that node and npm tools are installed, copies
    frontend resources available inside `.jar` dependencies to `node_modules`,
    and creates or updates `package.json` and `webpack.config.json` files.
  Deprecated. use {@link PrepareFrontendMojo} instead

For more information, run 'mvn help:describe [...] -Ddetail'

...
Enter fullscreen mode Exit fullscreen mode

Another example, you can use this with the help plugin itself:

mvn help:describe -Dplugin=help
Enter fullscreen mode Exit fullscreen mode

The Result:

Name: Apache Maven Help Plugin
Description: The Maven Help plugin provides goals aimed at helping to make
  sense out of the build environment. It includes the ability to view the
  effective POM and settings files, after inheritance and active profiles have
  been applied, as well as a describe a particular plugin goal to give usage
  information.
Group Id: org.apache.maven.plugins
Artifact Id: maven-help-plugin
Version: 3.3.0
Goal Prefix: help

This plugin has 8 goals:

help:active-profiles
  Description: Displays a list of the profiles which are currently active for
    this build.

help:all-profiles
  Description: Displays a list of available profiles under the current
    project.
    Note: it will list all profiles for a project. If a profile comes up with a
    status inactive then there might be a need to set profile activation
    switches/property.

help:describe
  Description: Displays a list of the attributes for a Maven Plugin and/or
    goals (aka Mojo - Maven plain Old Java Object).

help:effective-pom
  Description: Displays the effective POM as an XML for this build, with the
    active profiles factored in, or a specified artifact. If verbose, a comment
    is added to each XML element describing the origin of the line.

help:effective-settings
  Description: Displays the calculated settings as XML for this project,
    given any profile enhancement and the inheritance of the global settings
    into the user-level settings.

help:evaluate
  Description: Evaluates Maven expressions given by the user in an
    interactive mode.

help:help
  Description: Display help information on maven-help-plugin.
    Call mvn help:help -Ddetail=true -Dgoal=<goal-name> to display parameter
    details.

help:system
  Description: Displays a list of the platform details like system properties
    and environment variables.
Enter fullscreen mode Exit fullscreen mode

You can even more details if you add -Ddetail to your command.

mvn help:describe -Dplugin=help -Ddetail
Enter fullscreen mode Exit fullscreen mode

The Result:

...
help:system
  Description: Displays a list of the platform details like system properties
    and environment variables.
  Implementation: org.apache.maven.plugins.help.SystemMojo
  Language: java

  Available parameters:

    output
      User property: output
      Optional parameter to write the output of this help in a given file,
      instead of writing to the console.
      Note: Could be a relative path.
...
Enter fullscreen mode Exit fullscreen mode

Top comments (0)