After releasing (and I know Tycho does not support that, but we made it work somehow) I want to change the version of the Manifest.MF automatically from the pom.xml - in the future even in the same build process.
While researching for how to implement a custom Maven plug-in I found the tycho-versions-plugin
, which almost seems to do what I want, so I added it to the build:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-versions-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>versions</id>
<phase>validate</phase>
<goals>
<goal>set-version</goal>
</goals>
</execution>
</executions>
<configuration>
<newVersion>${project.version}</newVersion>
</configuration>
</plugin>
Now this only works if the Manifest.MF and the pom.xml already have the same version, which is useless in my case. Is there some obscure parameter I'm missing or do I really have to develop my own plug-in for the exotic use-case of incrementing the version?
If someone wants to fix their own tycho-versions-plugin
, here's what I did to make it work. In VersionsEngine
I removed the if
in the following method:
public void addVersionChange(String artifactId, String newVersion) throws IOException {
MutablePomFile pom = getMutablePom(artifactId);
// if (!newVersion.equals(pom.getVersion())) {
addVersionChange(new VersionChange(pom, newVersion));
// }
}
And I'm not entirely sure if that's necessary or even wise, but I changed the following method in BundleManifestManipulator
:
private boolean isProjectVersionChange(ProjectMetadata project, VersionChange change) {
MutableBundleManifest mf = getBundleManifest(project);
return change.getArtifactId().equals(mf.getSymbolicName());
}