Skip to content

System user property to skip? #268

Description

@vorburger

It would be nice to have if this Maven plugin had a -D user system property to skip its execution...

I realize that you can use the following in a POM, but can't see how to do this from CLI w.o. changing code:

<configuration>
  <skip>true</skip>
</configuration>

As far as I understand Maven, support for being able to do something like mvn -Dmaven.gitcommitid.skip=true package would have to be coded into the Mojo (although I may be wrong).

FYI: The *.skip suffix naming convention seems to be what all of the core Maven plugins use; e.g. maven.javadoc.ski, maven.source.skip etc. or also checkstyle.skip, findbugs.skip, pmd.skip, cpd.skip, etc.

Activity

  1. ktoso commented on Dec 14, 2016

    @ktoso
    Collaborator

    If that's implemented this way by these other plugins it seems we should do it too.
    Would you be able to send in a PR?

    The plugin is not very actively developed by myself, however I'm happy to review/merge/and release if you'd provide a PR for this.

  2. TheSnoozer commented on Jan 2, 2017

    @TheSnoozer
    Collaborator

    Should be super easy to add this.
    maven-surefire-plugin has this option:
    https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html

    Magic is hidden here:
    https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L152

    Based on https://maven.apache.org/guides/plugin/guide-java-plugin-development#Parameters

    Defining a parameter is as simple as creating an instance variable in the mojo and adding the proper annotations. Listed below is an example of a parameter for the simple mojo:

            /**
             * The greeting to display.
             */
            @Parameter( property = "sayhi.greeting", defaultValue = "Hello World!" )
            private String greeting;

    The portion before the annotations is the description of the parameter. The parameter annotation identifies the variable as a mojo parameter. The defaultValue parameter of the annotation defines the default value for the variable. This value can include expressions which reference the project, such as "${project.version}" (more can be found in the "Parameter Expressions" document). The property parameter can be used to allow configuration of the mojo parameter from the command line by referencing a system property that the user sets via the -D option.

  3. added a commit that references this issue on Mar 16, 2017
  4. added this to the 2.2.3 milestone on Mar 16, 2017
  5. shague commented on Mar 16, 2017

    @shague

    This is great, was just looking for something like this. Any idea when the 2.2.3 version will be released to Maven Central?

  6. added a commit that references this issue on Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions