プロジェクトのマニフェストにSVNリビジョン番号を追加しようとしています。そのために、Mavenビルド番号プラグインを使用して、SuperPOMに次の行を追加しました。
<!-- Gets the SVN revision number -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
</plugin>
<!-- Add the SVN revision number in the manifest (works on Hudson only) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Build>${buildNumber}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
構成に注意してください。
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
ローカルで変更を加えた場合、「doCheck」を使用するとコンパイルできなくなるため、意図的にこれを行いました(そして、作業をコミットする前にコンパイルしてテストしたいと思います)。
「doUpdate」も私にとって問題です。リポジトリからコードを更新する必要は必ずしもないからです。上記と同じ理由で、コミットする(そして潜在的に競合を解決する)前にローカルでテストしたいと思います。
私の問題は、マニフェストに表示されるのは次のとおりです。
Implementation-Build: ${buildNumber}
したがって、変数は解釈されません。私は何を取りこぼしたか?
ありがとう
編集: 問題は実際にはmaven-bundle-pluginにあります。私はこれをプロジェクトで使用してOSGiバンドルを生成します。
したがって、プロジェクトのPOMパッケージは次のようになります。
<packaging>bundle</packaging>
それ以外の:
<packaging>jar</packaging>
これはMavenのライフサイクルを台無しにしていると思います。maven-bundle-pluginを削除すると、すべてが正常に機能します。しかし、私のアプリケーションはOSGiアプリであるため、削除できません。