Maven自定义存档扩展-如何使用解压缩依赖关系? [英] Maven custom archive extension - how do I use unpack-dependencies?

查看:87
本文介绍了Maven自定义存档扩展-如何使用解压缩依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的伪像类型web-module;只是一个ZIP,但带有自定义扩展名.

I have a custom artfiact type web-module; just a ZIP but with a custom extension.

然后我有一个依赖于它的项目,我希望解压缩此自定义类型的依赖项. maven-dependency-plugin

I then have a project depending on it, I want its dependencies of this custom type to be unpacked. The maven-dependency-plugin unpack-dependencies goal seemed to fit the bill, however I keep getting the error:

[INFO] Unknown archiver type
Embedded error: No such archiver: 'web-module'.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unknown archiver type
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    ...

我已经做了一些 Google搜索并且了解我可以在我的自定义插件的 components.xml 中指定自定义的非存档类型.现在在我的 components.xml 中:

I've done some Googling and understood that I can specifiy a custom unarchiver type in my custom plugin's components.xml. The following is now in my components.xml:

<component>
  <role>org.codehaus.plexus.archiver.UnArchiver</role>
  <role-hint>web-module</role-hint>
  <implementation>org.codehaus.plexus.archiver.zip.ZipUnArchiver</implementation>
  <instantiation-strategy>per-lookup</instantiation-strategy>
</component>

完成自定义插件的安装后,我再次尝试了,仍然没有运气!有人知道我要去哪里了吗?

Once an install of my custom plugin was performed I tried again, still no luck! Anyone know where I'm going wrong?

我还尝试使用<extensions>true</extensions>将自定义扩展插件添加到错误模块的POM中.

I have also tried adding the custom extension plugin to the erroring module's POM with <extensions>true</extensions>.

推荐答案

尝试如下:

<component-set>
    <components>
        <!-- Life-cycle mappings -->
        <component>
            <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
            <role-hint>web-module</role-hint>
             <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
            <configuration>
                <phases>
                    <!-- You might need these as well. -->
                </phases>
            </configuration>
        </component>

        <!-- Artifact Handlers -->
        <component>
            <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
            <role-hint>web-module</role-hint>
            <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
            <configuration>
                <extension>web-module</extension>
                <type>web-module</type>
                <packaging>web-module</packaging>
            </configuration>
        </component>
    </components>
</component-set>

这篇关于Maven自定义存档扩展-如何使用解压缩依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆