Class BaseMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    NextMojo, ReleaseMojo

    public abstract class BaseMojo
    extends org.apache.maven.plugin.AbstractMojo
    Author:
    Roland Hauser sourcepond@gmail.com
    • Field Summary

      Fields 
      Modifier and Type Field Description
      String arguments
      Additional arguments to pass to Maven during a release.
      protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
      Used to look up Artifacts in the remote repository.
      protected Long buildNumber
      The build number to use in the release version.
      protected org.apache.maven.artifact.factory.ArtifactFactory factory
      Used to look up Artifacts in the remote repository.
      protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
      Location of the local repository.
      protected List<String> modulesToForceRelease
      A module to force release on, even if no changes has been detected.
      protected List<String> modulesToRelease
      The modules to release, or no value to to release the project from the root pom, which is the default.
      protected NoChangesAction noChangesAction
      Determines the action to take when no module changes are detected.
      protected org.apache.maven.project.MavenProject project
      The Maven Project.
      protected List<org.apache.maven.project.MavenProject> projects  
      protected boolean pullTags
      Fetch tags from remote repository to determine the next build number.
      protected List remoteRepositories
      List of Remote Repositories used by the resolver
      protected VersionNamer versionNamer
      Configures the version naming.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseMojo()  
    • Field Detail

      • project

        @Parameter(property="project",
                   required=true,
                   readonly=true,
                   defaultValue="${project}")
        protected org.apache.maven.project.MavenProject project
        The Maven Project.
      • projects

        @Parameter(property="projects",
                   required=true,
                   readonly=true,
                   defaultValue="${reactorProjects}")
        protected List<org.apache.maven.project.MavenProject> projects
      • buildNumber

        @Parameter(property="buildNumber")
        protected Long buildNumber

        The build number to use in the release version. Given a snapshot version of "1.0-SNAPSHOT" and a buildNumber value of "2", the actual released version will be "1.0.2".

        By default, the plugin will automatically find a suitable build number. It will start at version 0 and increment this with each release.

        This can be specified using a command line parameter ("-DbuildNumber=2") or in this plugin's configuration.

      • versionNamer

        @Parameter(property="versionNamer")
        protected VersionNamer versionNamer

        Configures the version naming.

      • modulesToRelease

        @Parameter(alias="modulesToRelease",
                   property="modulesToRelease")
        protected List<String> modulesToRelease
        The modules to release, or no value to to release the project from the root pom, which is the default. The selected module plus any other modules it needs will be built and released also. When run from the command line, this can be a comma-separated list of module names.
      • modulesToForceRelease

        @Parameter(alias="forceRelease",
                   property="forceRelease")
        protected List<String> modulesToForceRelease
        A module to force release on, even if no changes has been detected.
      • noChangesAction

        @Parameter(alias="noChangesAction",
                   defaultValue="ReleaseAll",
                   property="noChangesAction")
        protected NoChangesAction noChangesAction
        Determines the action to take when no module changes are detected. Possible values: ReleaseAll, ReleaseNone, FailBuild
      • factory

        @Component
        protected org.apache.maven.artifact.factory.ArtifactFactory factory
        Used to look up Artifacts in the remote repository.
      • artifactResolver

        @Component
        protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
        Used to look up Artifacts in the remote repository.
      • remoteRepositories

        @Parameter(property="remoteRepositories",
                   required=true,
                   readonly=true,
                   defaultValue="${project.remoteArtifactRepositories}")
        protected List remoteRepositories
        List of Remote Repositories used by the resolver
      • localRepository

        @Parameter(property="localRepository",
                   required=true,
                   readonly=true,
                   defaultValue="${localRepository}")
        protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
        Location of the local repository.
      • pullTags

        @Parameter(alias="pullTags",
                   property="pull",
                   defaultValue="true")
        protected boolean pullTags
        Fetch tags from remote repository to determine the next build number. If false, then tags from the local repository will be used instead. Make sure they are up to date to avoid problems.
      • arguments

        @Parameter(property="arguments")
        public String arguments

        Additional arguments to pass to Maven during a release.

        To pass multiple system properties from the command line, use -Darguments="-Dprop.1=prop1value -Dprop.2=prop2value"

        To configure arguments in your pom, in the <configuration> node add: <arguments>'-Dprop.1=prop 1 value' -Dprop.2=prop2value</arguments>

    • Constructor Detail

      • BaseMojo

        public BaseMojo()
    • Method Detail

      • getCredentialsProvider

        protected org.eclipse.jgit.transport.CredentialsProvider getCredentialsProvider​(org.apache.maven.plugin.logging.Log log)
                                                                                 throws ValidationException
        Throws:
        ValidationException
      • configureJsch

        protected final void configureJsch​(org.apache.maven.plugin.logging.Log log)
      • getRemoteUrlOrNullIfNoneSet

        protected static String getRemoteUrlOrNullIfNoneSet​(org.apache.maven.model.Scm originalScm,
                                                            org.apache.maven.model.Scm actualScm)
                                                     throws ValidationException
        Throws:
        ValidationException