如何防止使用Maven Bundle插件将某些属性添加到bundle的清单中?

时间:2013-03-20 14:39:21

标签: java maven osgi maven-bundle-plugin

我想从我的发布jar中删除某些标题(例如“Built-by”)。

我已经读过将标题设置为空内容应该可以解决问题,但这对我不起作用。例如,我正在使用:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.3.7</version>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            <Built-By>a</Built-By>
            <Build-Jdk></Build-Jdk>
            <Created-By></Created-By>
            <Somethng-else>Hello</Somethng-else>
        </instructions>
    </configuration>
</plugin>

在添加Something-else时,所有其他标头(例如Built-By)仍然存在。任何见解?谢谢!

2 个答案:

答案 0 :(得分:2)

<_removeheaders>Build-*</_removeheaders>

很高兴听到您发现该插件很烦人(似乎没有找到manual)。

答案 1 :(得分:0)

我使用maven-jar-plugin,这是我的pom pice:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <goals>
                <goal>test-jar</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <archive>
            <manifest>
               <addClasspath>true</addClasspath>
               <mainClass>...MyClass</mainClass>
               <classpathPrefix>libs/</classpathPrefix>
               <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
                <Built-By>a</Built-By>
                <Build-Jdk></Build-Jdk>
                <Created-By></Created-By>
                <Somethng-else>Hello</Somethng-else>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>