Class GoOfflineMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="go-offline",
          threadSafe=true)
    public class GoOfflineMojo
    extends AbstractDependencyFilterMojo
    Goal that resolves all project dependencies, including plugins and reports and their dependencies.
    Since:
    2.0
    • Field Detail

      • excludeReactor

        @Parameter(property="excludeReactor",
                   defaultValue="true")
        protected boolean excludeReactor
        Don't resolve plugins and artifacts that are in the current reactor.
        Since:
        2.7
    • Constructor Detail

      • GoOfflineMojo

        @Inject
        public GoOfflineMojo​(org.apache.maven.execution.MavenSession session,
                             org.sonatype.plexus.build.incremental.BuildContext buildContext,
                             org.apache.maven.project.MavenProject project,
                             ResolverUtil resolverUtil,
                             org.apache.maven.project.ProjectBuilder projectBuilder,
                             org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager)
    • Method Detail

      • doExecute

        protected void doExecute()
                          throws org.apache.maven.plugin.MojoExecutionException
        Main entry into mojo. Gets the list of dependencies, resolves all that are not in the Reactor, and iterates through displaying the resolved versions.
        Specified by:
        doExecute in class AbstractDependencyMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException - with a message if an error occurs
      • getDependencyFilter

        private java.util.function.Predicate<org.apache.maven.model.Dependency> getDependencyFilter()
      • logMessage

        private void logMessage​(java.lang.String message)
      • resolveDependencyArtifacts

        protected java.util.List<org.eclipse.aether.artifact.Artifact> resolveDependencyArtifacts()
                                                                                           throws org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException,
                                                                                                  org.eclipse.aether.resolution.DependencyResolutionException
        This method resolves the dependency artifacts from the project.
        Returns:
        lis of resolved dependency artifacts
        Throws:
        org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException - in case of an error while filtering the artifacts
        org.eclipse.aether.resolution.DependencyResolutionException - in case of an error while resolving the artifacts
      • getProjectPlugins

        private java.util.Set<org.apache.maven.model.Plugin> getProjectPlugins()
        This method retrieve plugins list from the project.
        Returns:
        set of plugin used in project
      • toList

        private java.util.List<java.lang.String> toList​(java.lang.String list)
      • filterDependencies

        private java.util.Collection<org.apache.maven.model.Dependency> filterDependencies​(java.util.Collection<org.apache.maven.model.Dependency> deps)
                                                                                    throws org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException
        Throws:
        org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException
      • createArtifactSetFromDependencies

        private java.util.Set<org.apache.maven.artifact.Artifact> createArtifactSetFromDependencies​(java.util.Collection<org.apache.maven.model.Dependency> deps)
      • createDependencySetFromArtifacts

        private java.util.Collection<org.apache.maven.model.Dependency> createDependencySetFromArtifacts​(java.util.Set<org.apache.maven.artifact.Artifact> artifacts)
      • getArtifactsFilter

        protected org.apache.maven.shared.artifact.filter.collection.FilterArtifacts getArtifactsFilter()
        Returns:
        FilterArtifacts
      • getMarkedArtifactFilter

        protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()
        Description copied from class: AbstractDependencyFilterMojo
        Return an ArtifactsFilter indicating which artifacts must be filtered out.
        Specified by:
        getMarkedArtifactFilter in class AbstractDependencyFilterMojo
        Returns:
        an ArtifactsFilter indicating which artifacts must be filtered out