Class BndPackagingLifecycleParticipant

  • All Implemented Interfaces:
    org.codehaus.plexus.logging.LogEnabled

    @Component(role=org.apache.maven.AbstractMavenLifecycleParticipant.class,
               hint="aQute.bnd.maven.plugin.BndPackagingLifecycleParticipant")
    public class BndPackagingLifecycleParticipant
    extends org.apache.maven.AbstractMavenLifecycleParticipant
    implements org.codehaus.plexus.logging.LogEnabled
    This lifecycle participant is meant to simplify the changes required to the configuration of the maven packaging plugins when the bnd-maven-plugin is used. It will silently "scan" projects, and disable the maven-jar-plugin or the maven-war-plugin appropriately.

    Lifecycle participants are only active when the host plugin (bnd-maven-plugin in this case) has:

    <extensions>true</extensions>

    This acts as the opt-in. Without it the bnd-maven-plugin, maven-jar-plugin and maven-war-plugin behave in the traditional fashion.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterProjectsRead​(org.apache.maven.execution.MavenSession session)  
      void enableLogging​(org.codehaus.plexus.logging.Logger logger)  
      protected java.util.Optional<org.apache.maven.model.PluginExecution> findMatchingMavenPackagingPluginExecution​(org.apache.maven.model.Plugin mavenPackagingPlugin, java.lang.String classifier)  
      protected org.apache.maven.model.Plugin getBndMavenPlugin​(org.apache.maven.model.Model model)
      Returns the bnd-maven-plugin from build/plugins section of model or null if not present.
      protected org.apache.maven.model.Plugin getBndMavenPluginFromContainer​(org.apache.maven.model.PluginContainer pluginContainer)
      Returns the bnd-maven-plugin from pluginContainer or null if not present.
      protected org.apache.maven.model.Plugin getMavenJarPlugin​(org.apache.maven.model.Model model)
      Returns the maven-jar-plugin from build/plugins section of model or null if not present.
      protected org.apache.maven.model.Plugin getMavenJarPluginFromContainer​(org.apache.maven.model.PluginContainer pluginContainer)
      Returns the maven-jar-plugin from pluginContainer or null if not present.
      protected org.apache.maven.model.Plugin getMavenWarPlugin​(org.apache.maven.model.Model model)
      Returns the maven-war-plugin from build/plugins section of model or null if not present.
      protected org.apache.maven.model.Plugin getMavenWarPluginFromContainer​(org.apache.maven.model.PluginContainer pluginContainer)
      Returns the maven-war-plugin from pluginContainer or null if not present.
      protected org.apache.maven.model.Plugin getPluginByGAFromContainer​(java.lang.String groupId, java.lang.String artifactId, org.apache.maven.model.PluginContainer pluginContainer)  
      protected java.lang.String nullToEmpty​(java.lang.String str)  
      protected void processExecutions​(java.util.List<org.apache.maven.model.PluginExecution> bndMavenPluginExecutions, org.apache.maven.model.Plugin mavenPackagingPlugin, org.apache.maven.project.MavenProject project)  
      • Methods inherited from class org.apache.maven.AbstractMavenLifecycleParticipant

        afterSessionEnd, afterSessionStart
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • THIS_GROUP_ID

        public static java.lang.String THIS_GROUP_ID
      • THIS_ARTIFACT_ID

        public static java.lang.String THIS_ARTIFACT_ID
      • MAVEN_JAR_PLUGIN_GROUP_ID

        public static java.lang.String MAVEN_JAR_PLUGIN_GROUP_ID
      • MAVEN_JAR_PLUGIN_ARTIFACT_ID

        public static java.lang.String MAVEN_JAR_PLUGIN_ARTIFACT_ID
      • MAVEN_WAR_PLUGIN_GROUP_ID

        public static java.lang.String MAVEN_WAR_PLUGIN_GROUP_ID
      • MAVEN_WAR_PLUGIN_ARTIFACT_ID

        public static java.lang.String MAVEN_WAR_PLUGIN_ARTIFACT_ID
      • logger

        private org.codehaus.plexus.logging.Logger logger
    • Constructor Detail

      • BndPackagingLifecycleParticipant

        public BndPackagingLifecycleParticipant()
    • Method Detail

      • afterProjectsRead

        public void afterProjectsRead​(org.apache.maven.execution.MavenSession session)
                               throws org.apache.maven.MavenExecutionException
        Overrides:
        afterProjectsRead in class org.apache.maven.AbstractMavenLifecycleParticipant
        Throws:
        org.apache.maven.MavenExecutionException
      • enableLogging

        public void enableLogging​(org.codehaus.plexus.logging.Logger logger)
        Specified by:
        enableLogging in interface org.codehaus.plexus.logging.LogEnabled
      • findMatchingMavenPackagingPluginExecution

        protected java.util.Optional<org.apache.maven.model.PluginExecution> findMatchingMavenPackagingPluginExecution​(org.apache.maven.model.Plugin mavenPackagingPlugin,
                                                                                                                       java.lang.String classifier)
      • getBndMavenPlugin

        protected org.apache.maven.model.Plugin getBndMavenPlugin​(org.apache.maven.model.Model model)
        Returns the bnd-maven-plugin from build/plugins section of model or null if not present.
      • getBndMavenPluginFromContainer

        protected org.apache.maven.model.Plugin getBndMavenPluginFromContainer​(org.apache.maven.model.PluginContainer pluginContainer)
        Returns the bnd-maven-plugin from pluginContainer or null if not present.
      • getMavenJarPlugin

        protected org.apache.maven.model.Plugin getMavenJarPlugin​(org.apache.maven.model.Model model)
        Returns the maven-jar-plugin from build/plugins section of model or null if not present.
      • getMavenJarPluginFromContainer

        protected org.apache.maven.model.Plugin getMavenJarPluginFromContainer​(org.apache.maven.model.PluginContainer pluginContainer)
        Returns the maven-jar-plugin from pluginContainer or null if not present.
      • getMavenWarPlugin

        protected org.apache.maven.model.Plugin getMavenWarPlugin​(org.apache.maven.model.Model model)
        Returns the maven-war-plugin from build/plugins section of model or null if not present.
      • getMavenWarPluginFromContainer

        protected org.apache.maven.model.Plugin getMavenWarPluginFromContainer​(org.apache.maven.model.PluginContainer pluginContainer)
        Returns the maven-war-plugin from pluginContainer or null if not present.
      • getPluginByGAFromContainer

        protected org.apache.maven.model.Plugin getPluginByGAFromContainer​(java.lang.String groupId,
                                                                           java.lang.String artifactId,
                                                                           org.apache.maven.model.PluginContainer pluginContainer)
      • nullToEmpty

        protected java.lang.String nullToEmpty​(java.lang.String str)
      • processExecutions

        protected void processExecutions​(java.util.List<org.apache.maven.model.PluginExecution> bndMavenPluginExecutions,
                                         org.apache.maven.model.Plugin mavenPackagingPlugin,
                                         org.apache.maven.project.MavenProject project)