Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] tycho-versions-plugin:set-version only modifies features, not plugins

First, don't use tycho-versions-plugin in build lifecycle, it is only
meant for direct invocation.

As for plugin versions not being replaced,
tycho-versions-plugin:set-version works as "change version" refactoring,
it starts with some initial version changed (current project by default,
but this is configurable), then recursively finds and updates all
referenced to the changed version in pom.xml and corresponding
eclipse/osgi metadata files. If this does not explain the behaviour you
see, please provide a small standalone example that demonstrates the
problem and I'll have a look.

--
Regards,
Igor

On 1/29/2014, 14:52, Nikolay Glazyrin wrote:
Hello, tycho-user list members

We have an Eclipse application that consists of hundreds of plugins
grouped into a number of features. Tycho is used to build an update site
that provides all features. To make the development easier, all plugins
have version 1.0.0 in manifests and all dependencies on our plugins have
version 0.0.0.

I want to automatically set version to all plugins and features during
every build, so that instead of version 1.0.0 they appear on the update
site as having some meaningful version, say, 3.14.${buildNumber}
(buildNumber property is passed as a maven command line argument). This
will be done only on a build server (developers can switch off the
plugin execution using maven profile). I tried to use
tycho-versions-plugin to achieve that by adding these lines to the
master pom:

<plugin>

      <groupId>org.eclipse.tycho</groupId>

      <artifactId>tycho-versions-plugin</artifactId>

      <version>${tycho.version}</version>

      <executions>

           <execution>

                 <configuration>

                      <newVersion>3.14.${buildNumber}</newVersion>

                 </configuration>

                 <goals>

                      <goal>set-version</goal>

                 </goals>

                 <id>set-version-all</id>

                 <phase>validate</phase>

           </execution>

           <execution>

                <configuration>

                     <newVersion>1.0.0-SNAPSHOT</newVersion>

                 </configuration>

                 <inherited>false</inherited>

                 <goals>

                      <goal>set-version</goal>

                 </goals>

                 <id>restore-version-master</id>

                 <phase>validate</phase>

           </execution>

      </executions>

</plugin>

2^nd execution was required because the first one doesn’t replace parent
version in child poms. Master pom doesn’t go to the update site, so it’s
ok to restore it to 1.0.0-SNAPSHOT.

This code is being run on a build server, where poms and manifests get
rewritten with the latest version from SVN before every build anyway, so
I can pollute them by calling tycho-versions-plugin.

Here is what I get in the log for a typical plugin:

build 29-jan-2014 13:17:21 [INFO]
------------------------------------------------------------------------

build 29-jan-2014 13:17:21 [INFO] Building com.mycompany.myplugin 1.0.0

build 29-jan-2014 13:17:21 [INFO]
------------------------------------------------------------------------

build 29-jan-2014 13:17:21 [INFO]

build 29-jan-2014 13:17:21 [INFO] --- maven-clean-plugin:2.5:clean
(default-clean) @ com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO] Deleting
C:\<SVN_ROOT>\build\com.mycompany.myplugin

build 29-jan-2014 13:17:21 [INFO]

build 29-jan-2014 13:17:21 [INFO] ---
tycho-packaging-plugin:0.19.0:build-qualifier (default-build-qualifier)
@ com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO] The project's OSGi version is 1.0.0

build 29-jan-2014 13:17:21 [INFO]

build 29-jan-2014 13:17:21 [INFO] ---
tycho-packaging-plugin:0.19.0:validate-id (default-validate-id) @
com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO]

build 29-jan-2014 13:17:21 [INFO] ---
tycho-packaging-plugin:0.19.0:validate-version
(default-validate-version) @ com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO]

build 29-jan-2014 13:17:21 [INFO] ---
tycho-versions-plugin:0.19.0:set-version (set-version-all) @
com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO] Making changes in
C:\<SVN_ROOT>\plugins\com.mycompany.myplugin

build 29-jan-2014 13:17:21 [INFO]   pom.xml//project/version: 1.0.0 =>
3.14.171

build 29-jan-2014 13:17:21 [INFO]
META-INF/MANIFEST.MF//Bundle-Version: 1.0.0 => 3.14.171

build 29-jan-2014 13:17:21 [INFO]
META-INF/MANIFEST.MF//Export-Package//version: 1.0.0 => 3.14.171

build 29-jan-2014 13:17:21 [INFO] ---
maven-resources-plugin:2.4.3:resources (default-resources) @
com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO]

build 29-jan-2014 13:17:21 [INFO] ---
tycho-compiler-plugin:0.19.0:compile (default-compile) @
com.mycompany.myplugin ---

build 29-jan-2014 13:17:21 [INFO] Compiling 2 source files to
C:\<SVN_ROOT>\build\com.mycompany.myplugin\classes

build 29-jan-2014 13:17:22 [INFO]

build 29-jan-2014 13:17:22 [INFO] ---
maven-resources-plugin:2.4.3:testResources (default-testResources) @
com.mycompany.myplugin ---

build 29-jan-2014 13:17:22 [INFO]

build 29-jan-2014 13:17:22 [INFO] ---
tycho-packaging-plugin:0.19.0:package-plugin (default-package-plugin) @
com.mycompany.myplugin ---

build 29-jan-2014 13:17:22 [INFO] Building jar:
C:\<SVN_ROOT>\build\com.mycompany.myplugin\com.mycompany.myplugin-1.0.0.jar

build 29-jan-2014 13:17:22 [INFO]

build 29-jan-2014 13:17:22 [INFO] ---
tycho-p2-plugin:0.19.0:p2-metadata-default (default-p2-metadata-default)
@ com.mycompany.myplugin ---

build 29-jan-2014 13:17:22 [INFO]

build 29-jan-2014 13:17:22 [INFO] --- maven-jarsigner-plugin:1.3.1:sign
(sign) @ com.mycompany.myplugin ---

build 29-jan-2014 13:17:22 [INFO] 1 archive(s) processed

build 29-jan-2014 13:17:22 [INFO]

This results in com.mycompany.myplugin-1.0.0.jar with version 1.0.0 in
the manifest.

But for all features the version gets changed!

build 29-jan-2014 13:17:26 [INFO]
------------------------------------------------------------------------

build 29-jan-2014 13:17:26 [INFO] Building com.mycompany.myfeature 1.0.0

build 29-jan-2014 13:17:26 [INFO]
------------------------------------------------------------------------

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] --- maven-clean-plugin:2.5:clean
(default-clean) @ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO] Deleting
C:\<SVN_ROOT>\build\com.mycompany.myfeature

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-packaging-plugin:0.19.0:build-qualifier-aggregator
(default-build-qualifier-aggregator) @ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO] The project's OSGi version is 1.0.0

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-packaging-plugin:0.19.0:validate-id (default-validate-id) @
com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-packaging-plugin:0.19.0:validate-version
(default-validate-version) @ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-versions-plugin:0.19.0:set-version (set-version-all) @
com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO] Making changes in
C:\<SVN_ROOT>\features\com.mycompany.myfeature

build 29-jan-2014 13:17:26 [INFO]   pom.xml//project/version: 1.0.0 =>
3.14.171

build 29-jan-2014 13:17:26 [INFO]   feature.xml//feature/@version: 1.0.0
=> 3.14.171

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-packaging-plugin:0.19.0:package-feature (default-package-feature)
@ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO] Building jar:
C:\<SVN_ROOT>\build\com.mycompany.myfeature\com.mycompany.myfeature-1.0.0.jar

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-p2-plugin:0.19.0:p2-metadata-default (default-p2-metadata-default)
@ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] ---
tycho-p2-plugin:0.19.0:feature-p2-metadata (default-feature-p2-metadata)
@ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO]

build 29-jan-2014 13:17:26 [INFO] --- maven-jarsigner-plugin:1.3.1:sign
(sign) @ com.mycompany.myfeature ---

build 29-jan-2014 13:17:26 [INFO] 1 archive(s) processed

This results in com.mycompany.myfeature-3.14.171.jar (though the log
says it is 1.0.0) with version 3.14.171 in the manifest.

As a result, tycho-versions-plugin updates the versions in all required
files, but for some reason this has no impact on plugins, only feature
versions really get updated. How can I update plugin versions too? Or
maybe I’m doing something conceptually wrong?

As far as I know, tycho-packaging-plugin can only set the qualifier. We
can change plugin versions in manifests to 1.0.0.qualifier, but we don’t
really want to change them after every release to 3.14.qualifier, then
3.15… and so on. I have also tried to call
tycho-packaging-plugin:build-qualifier after calling
tycho-versions-plugin:set-version, but the result was exactly the same
(only feature versions were updated).

Any help will be appreciated.

Thank you

Nikolay Glazyrin



_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user



Back to the top