繁体   English   中英

Maven:`未知包装:bundle`依赖包装中的错误

[英]Maven: `Unknown packaging: bundle` error from a dependency packaging as bundle

我在项目中运行mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy-dependencies ,并且看到以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy-dependencies (default-cli) on project beam-sdks-java-core: Some problems were encountered while processing the POMs:
[ERROR] [ERROR] Unknown packaging: bundle @ line 6, column 16: 1 problem was encountered while building the effective model for org.xerial.snappy:snappy-java:1.1.4
[ERROR] [ERROR] Unknown packaging: bundle @ line 6, column 16

查看Snappy的pom文件,看起来像这样:

<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.xerial.snappy</groupId>
    <artifactId>snappy-java</artifactId>
    <packaging>bundle</packaging>
    <description>snappy-java: A fast compression/decompression library</description>
    <version>1.1.4</version>
    <name>snappy-java</name>
    ....

具体来说, <packaging>bundle</packaging>行似乎是问题所在。

我尝试将maven-bundle-plugin到我自己的POM文件的<build>标记中,但是那不能解决(为什么呢?我认为依赖项的配置不应该影响我的pom?)

如何为我的依赖项启用maven-bundle-plugin 我是否需要将其添加到pom的特定小节中,该小节引用apache.maven.plugins:maven-dependency-plugin:3.1.1:copy-dependencies

另外,有关其他信息,我的Maven版本是3.5.0。

我尝试将maven-bundle-plugin添加到我自己的POM文件的标签中,但是那不能解决(为什么呢?我认为依赖项的配置不应该影响我的pom吗?

而且您是对的:您不是需要添加maven-bundle-plugin dependency项才能使bundle软件包在您的构建中可用。
您需要添加maven-bundle-plugin作为plugin来增强默认的Maven生命周期,例如:

<build>
  <plugins>
     <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Include-Resource> 
                     ....
                </Include-Resource>
            </instructions>
        </configuration>
     </plugin>
  </plugins>
<build>

您可以在apache-felix-maven-bundle-plugin找到该信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM