Unter der Annahme, dass Ihre Jenkins Prozess baut irgendwie die Projektversion eine mögliche Lösung aktualisieren ist:
in nbproject\build-impl.xml
einen Eintrag hinzufügen für das Manifest
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" ...
<manifest file="${tmp.manifest.file}" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
<!-- add this line below -->
<attribute name="Project-Version" value="${project.version}"/>
</manifest>
</target>
in nbproject\project.properties
die Version Projekt hinzufügen
project.version=0.0.1-SNAPSHOT
bauen
Ausgang
$ unzip -p dist/CI-test.jar META-INF/MANIFEST.MF | grep Project
Project-Version: 0.0.1-SNAPSHOT
edit: Eine andere Lösung, die eine Umgebungsvariable.
in nbproject\build-impl.xml
einen Eintrag für das Manifest hinzufügen die Umgebungsvariable PROJECT_VERSION
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" ...
<!-- enable access to environment variables -->
<property environment="env"/>
<manifest file="${tmp.manifest.file}" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
<!-- add this line below -->
<attribute name="Project-Version" value="${env.PROJECT_VERSION}"/>
</manifest>
</target>
build
# define the environment variable
# on Windows use: set PROJECT_VERSION=0.0.2-SNAPSHOT
PROJECT_VERSION=0.0.2-SNAPSHOT
ant jar
Ausgang
$ unzip -p dist/CI-test.jar META-INF/MANIFEST.MF | grep Project
Project-Version: 0.0.2-SNAPSHOT
Weitere Informationen finden sie unter Verwendung. Ich habe ein weiteres Beispiel mit einer Umgebungsvariablen hinzugefügt. – SubOptimal