Project build error: Unknown packaging: bundle

Project build error: Unknown packaging: bundle

我正在尝试构建 pdfbox 但我似乎无法解决此 Maven 错误:

Project build error: Unknown packaging: bundle

仅出现在子项目pdfboxpreflight中。

我已经按照建议安装了 m2e 连接器和构建助手 here 我已经安装了 Tycho,但它也没有帮助。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox-parent</artifactId>
        <version>2.0.0-SNAPSHOT</version>
        <relativePath>../parent/pom.xml</relativePath>
    </parent>

    <artifactId>pdfbox</artifactId>
    <packaging>bundle</packaging> <!-- Project build error: Unknown packaging: bundle -->

    <!-- ... -->

    <dependencies>
        <!-- ... -->
    </dependencies>

    <build>
       <!-- ... -->
    <pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <argLine>-Xmx128m</argLine>
                <excludes>
                    <exclude>org/apache/pdfbox/TestAll.java</exclude>
                    <exclude>org/apache/pdfbox/util/TestPDFToImage.java</exclude>
                </excludes>
                <systemPropertyVariables>
                    <java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>
                </systemPropertyVariables>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Include-Resource>
                        {maven-resources},
                        META-INF=target/maven-shared-archive-resources/META-INF,
                        org/apache/pdfbox/resources=target/classes/org/apache/pdfbox/resources
                    </Include-Resource>
                </instructions>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.rat</groupId>
            <artifactId>apache-rat-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>src/main/resources/org/apache/pdfbox/resources/afm/*</exclude>
                    <exclude>src/main/resources/org/apache/pdfbox/resources/icc/*</exclude>
                    <exclude>src/main/resources/org/apache/pdfbox/resources/glyphlist/glyphlist.txt</exclude>
                    <exclude>src/main/resources/org/apache/pdfbox/resources/glyphlist/zapfdingbats.txt</exclude>
                    <exclude>src/main/resources/META-INF/services/*</exclude>
                    <exclude>src/test/resources/input/rendering/*.ai</exclude>
                    <exclude>src/test/resources/output/*</exclude>
                    <exclude>release.properties</exclude>
                    <exclude>src/test/resources/org/apache/pdfbox/encryption/*.der</exclude>
                    <exclude>src/test/resources/org/apache/pdfbox/encryption/*.pfx</exclude>
                    <exclude>src/test/resources/org/apache/pdfbox/filter/*.bin</exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
    </pluginManagement>
    </build>

</project>

有人知道如何解决这个问题吗?

maven-bundle-plugin 移到 pluginManagement 之外。 Maven 将只查找 <build><plugins> 并使用 pluginManagement 获取更多信息。

在我的例子中,它已经在 plugin-management 标签之外。通过添加

为我解决了这个问题

<extensions>true</extensions>

到插件标签

为你的 pom.xml 试试这个,它适用于我的:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions> <!--add this line-->
            <configuration>
                <instructions>
                    <Export-Package>com.demo.hello.*</Export-Package>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
</build>

如果

https://github.com/rc-dukes/dukes/issues/22

有一个非常奇怪的行为。我们认为我们可以通过修改权限来解决这个问题。但事实上,它似乎与一些奇怪的 travis 行为有关,其中只有每第二或第三次构建成功 - 即使没有更改相关内容。我们还没有解决方案,但会在此处提及 work-around 以重试几次。欢迎任何关于真正修复的提示。