Class AbstractDockerMojo

    • Field Detail

      • project

        @Parameter(defaultValue="${project}",
                   readonly=true)
        protected org.apache.maven.project.MavenProject project
      • settings

        @Parameter(defaultValue="${settings}",
                   readonly=true)
        protected org.apache.maven.settings.Settings settings
      • session

        @Parameter(property="session")
        protected org.apache.maven.execution.MavenSession session
      • execution

        @Parameter(property="mojoExecution")
        protected org.apache.maven.plugin.MojoExecution execution
      • autoPull

        @Parameter(property="docker.autoPull")
        protected String autoPull
      • imagePullPolicy

        @Parameter(property="docker.imagePullPolicy")
        protected String imagePullPolicy
      • keepContainer

        @Parameter(property="docker.keepContainer",
                   defaultValue="false")
        protected boolean keepContainer
      • removeVolumes

        @Parameter(property="docker.removeVolumes",
                   defaultValue="false")
        protected boolean removeVolumes
      • useColor

        @Parameter(property="docker.useColor",
                   defaultValue="true")
        protected boolean useColor
      • verbose

        @Parameter(property="docker.verbose")
        protected String verbose
      • registry

        @Parameter(property="docker.registry")
        protected String registry
      • skipExtendedAuth

        @Parameter(property="docker.skip.extendedAuth",
                   defaultValue="false")
        protected boolean skipExtendedAuth
        Skip extended authentication
      • jib

        @Parameter(property="docker.build.jib",
                   defaultValue="false")
        public boolean jib
      • jibImageFormat

        @Parameter(property="docker.build.jib.imageFormat",
                   defaultValue="docker")
        public String jibImageFormat
      • sourceDirectory

        @Parameter(property="docker.source.dir",
                   defaultValue="src/main/docker")
        public String sourceDirectory
      • outputDirectory

        @Parameter(property="docker.target.dir",
                   defaultValue="target/docker")
        public String outputDirectory
      • packaging

        @Parameter(defaultValue="${project.packaging}",
                   required=true)
        protected String packaging
      • skipPom

        @Parameter(property="docker.skip.pom",
                   defaultValue="false")
        protected boolean skipPom
    • Constructor Detail

      • AbstractDockerMojo

        public AbstractDockerMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Entry point for this plugin. It will set up the helper class and then calls executeInternal(ServiceHub) which must be implemented by subclass.
        Specified by:
        execute in interface org.apache.maven.plugin.Mojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • getBuildTimestamp

        protected Date getBuildTimestamp()
                                  throws IOException
        Get the current build timestamp. this has either already been created by a previous call or a new current date is created
        Returns:
        timestamp to use
        Throws:
        IOException
      • getBuildTimestampFile

        protected File getBuildTimestampFile()
      • getLogPrefix

        protected String getLogPrefix()
        Log prefix to use when doing the logs
        Returns:
      • isDockerAccessRequired

        protected boolean isDockerAccessRequired()
        Override this if your mojo doesnt require access to a Docker host (like creating and attaching docker tar archives)
        Returns:
        true as the default value
      • executeInternal

        protected abstract void executeInternal​(ServiceHub serviceHub)
                                         throws IOException,
                                                ExecException,
                                                org.apache.maven.plugin.MojoExecutionException
        Hook for subclass for doing the real job
        Parameters:
        serviceHub - context for accessing backends
        Throws:
        IOException
        ExecException
        org.apache.maven.plugin.MojoExecutionException
      • getResolvedImages

        protected List<ImageConfiguration> getResolvedImages()
        Get all images to use. Can be restricted via -Ddocker.filter to pick a one or more images. The values are taken as comma separated list.
        Returns:
        list of image configuration to be use. Can be empty but never null.
      • getVolumes

        protected List<VolumeConfiguration> getVolumes()
        Get all volumes which are defined separately from the images
        Returns:
        defined volumes
      • contextualize

        public void contextualize​(org.codehaus.plexus.context.Context context)
                           throws org.codehaus.plexus.context.ContextException
        Specified by:
        contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
        Throws:
        org.codehaus.plexus.context.ContextException
      • getGavLabel

        protected GavLabel getGavLabel()
      • invokedTogetherWithDockerStart

        protected boolean invokedTogetherWithDockerStart()
      • getImageNameMatcher

        protected Matcher getImageNameMatcher​(String pattern,
                                              String configName)
                                       throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • getContainerNameMatcher

        protected Matcher getContainerNameMatcher​(String pattern,
                                                  String configName)
                                           throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • shouldSkipPom

        protected boolean shouldSkipPom()
      • createProjectPaths

        protected ProjectPaths createProjectPaths()