在Maven中,当我使用<packaging>jar</packaging>
时,我可以看到
~/.m2/repository/org/apache/maven/maven-core/3.0.3/maven-core-3.0.3.jar/META-INF/plexus/components.xml
但是,当我使用<packaging>kar</packaging>
构建Apache Karaf项目时,如何知道kar
的包类型的阶段,components.xml
中没有定义?
答案 0 :(得分:0)
这是在karaf-maven-plugin
内定义的。这个插件声明了自己的components.xml
。
采用代码from GitHub,这是kar
包装的生命周期:
<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>
所以这会调用:
process-resources
与org.apache.maven.plugins:maven-resources-plugin:resources
compile
与org.apache.karaf.tooling:karaf-maven-plugin:features-generate-descriptor
package
与org.apache.karaf.tooling:karaf-maven-plugin:kar
install
与org.apache.maven.plugins:maven-install-plugin:install
deploy
与org.apache.maven.plugins:maven-deploy-plugin:deploy
如果您想在m2 repo中查看它,您应该查看内部(假设您使用的是4.0.3版本)
~/.m2/repository/org/apache/karaf/tooling/4.0.3/karaf-maven-plugin-4.0.3.jar/META-INF/plexus/components.xml
答案 1 :(得分:0)
查看META-INF/plexus/components.xml
中的karaf-maven-plugin.jar
。
<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>
角色org.apache.maven.lifecycle.mapping.LifecycleMapping
定义生命周期配置。 role-hint
是您在pom中使用的包装类型。