How can I determine the phases for a specific type of packaging

advertisements

In Maven, when I use <packaging>jar</packaging>, I can see the default phases defined in

 ~/.m2/repository/org/apache/maven/maven-core/3.0.3/maven-core-3.0.3.jar/META-INF/plexus/components.xml

But when I use <packaging>kar</packaging> to build Apache Karaf project, how can I know the phases for package type of kar, which is not defined in components.xml?


This is defined inside the karaf-maven-plugin. This plugin declares its own components.xml.

Taking the code from GitHub, this is the lifecycle of the kar packaging:

<component>
    <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
    <role-hint>kar</role-hint>
    <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
    <configuration>
        <lifecycles>
            <lifecycle>
                <id>default</id>
                <phases>
                    <process-resources>
                        org.apache.maven.plugins:maven-resources-plugin:resources
                    </process-resources>
                    <compile>
                        org.apache.karaf.tooling:karaf-maven-plugin:features-generate-descriptor
                    </compile>
                    <package>
                        org.apache.karaf.tooling:karaf-maven-plugin:kar
                    </package>
                    <install>
                        org.apache.maven.plugins:maven-install-plugin:install
                    </install>
                    <deploy>
                        org.apache.maven.plugins:maven-deploy-plugin:deploy
                    </deploy>
                </phases>
            </lifecycle>
        </lifecycles>
    </configuration>
</component>

So this invokes:

  • process-resources with org.apache.maven.plugins:maven-resources-plugin:resources
  • compile with org.apache.karaf.tooling:karaf-maven-plugin:features-generate-descriptor
  • package with org.apache.karaf.tooling:karaf-maven-plugin:kar
  • install with org.apache.maven.plugins:maven-install-plugin:install
  • deploy with org.apache.maven.plugins:maven-deploy-plugin:deploy

If you want to take a look at it inside your m2 repo, you should look inside (supposing you're using version 4.0.3)

 ~/.m2/repository/org/apache/karaf/tooling/4.0.3/karaf-maven-plugin-4.0.3.jar/META-INF/plexus/components.xml