开发者

buildnumber-maven-plugin and maven-assembly-plugin

I've set up the buildnumber-maven-plugin to pull the version number from SVN and stash it away in the META-INF/MANIFEST.MF inside the jar. That works ok.

But when I try to use it togethe开发者_JS百科r with the maven-assembly-plugin to pack all the other libs together It doesn't seem to work, the version number stuff is not included in the manifest in the ...-jar-with-dependencies.jar.

Has anybody managed to get them to work together?

Alternatively: Is there a (reasonable simple) way to output the ${buildNumber} into a text file (.properties, perhaps) using Maven? An Ant task in Maven could do it I guess but is there an easier way?


Argh... after posting I found THIS: how to add arbitrary information in manifest from maven assembly plugin and smacked my head.

OK, so My maven-assembly-plugin bit in the pom now looks like this

<build> ... <plugins> ...
    <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>...</mainClass>          
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    </manifest>
                    <manifestEntries>
                        <Implementation-Build>${buildNumber}</Implementation-Build>
                    </manifestEntries>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜