Reputation: 1160
I am trying to insert value of implementation version to manifest file, but not of current project, as you can see in my code right now (<Implementation-Version>${project.version}</Implementation-Version>)
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>ispf-linux</finalName>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>desktop.linux.main.Main</mainClass>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
, but this dependency version. How to do that?
<dependency>
<groupId>registry</groupId>
<artifactId>desktop.common</artifactId>
<version>1.0.0</version>
</dependency>
Upvotes: 1
Views: 88
Reputation: 6717
I would suggest declaring a property for the version:
<properties>
<desktop.common.version>1.0.0</desktop.common.version>
</properties>
Then referencing this property in both places. Here:
<dependency>
<groupId>registry</groupId>
<artifactId>desktop.common</artifactId>
<version>${desktop.common.version}</version>
</dependency>
And here:
<manifestEntries>
<Implementation-Version>${desktop.common.version}</Implementation-Version>
</manifestEntries>
Upvotes: 2