5

我有一个自定义的人工制品类型web-module;只是一个 ZIP,但带有自定义扩展名。

然后我有一个依赖于它的项目,我希望解压缩它的这种自定义类型的依赖项。maven-dependency-plugin unpack-dependencies目标似乎符合要求,但是我不断收到错误消息:

[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)
    ...

我已经做了一些谷歌搜索,并了解到我可以在我的自定义插件的components.xml中指定一个自定义的 unarchiver 类型。以下内容现在在我的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>

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

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

4

1 回答 1

0

试试这样:

<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>
于 2014-03-10T11:51:39.990 回答