Skip to content

Batch File Usage

Nico Waldispuehl edited this page Jan 18, 2013 · 23 revisions

The Version Tiger batch files use an easy command language to automate large versioning tasks. It is a plain text format and the files contain one operation per line. Technically, the extension of the batch files is irrelevant, but if you want them to be recognized by the Eclipse plugin, you need to set the extension as .versiontiger.

This is a small example:

# sample.versiontiger

# Add projects to universe
project /home/me/workspace/com.inventage.project.plugin
project /home/me/workspace/com.inventage.project.depending_plugin1
project /home/me/workspace/com.inventage.project.depending_plugin2

# Release plugin, dependencies get updated automatically
release com.inventage.project.plugin

As you can observe, we use the hash ('#') as comment prefix. In the example above three projects are added to the (implicit) universe while we assume that 'depending_plugin1' and 'depending_plugin2' have dependencies on the 'plugin'. We then release the 'plugin' by calling the respective command, followed by the artifact id. Since we added the depending projects to the universe, all references to the 'plugin' get updated as well.

Available Commands

This is a presentation of the available commands. They can be used in batch files as well as in the interactive mode. You can also get a list of them by typing help in the interactive mode.

project <path>

Adds the project at the provided file system path to the ad hoc universe. Every instance of the Version Tiger forms its own universe.

Example

project /home/me/workspace/com.inventage.project.plugin

version <artifact id pattern> <version>

Updates the version in the projects matching the provided id pattern (use '*' as wildcard) to the provided one. Also updates all dependencies in the universe. The version has to be of the OSGI version format: n[.n[.n]][-SNAPSHOT].

Example

project /home/me/workspace/com.inventage.project.plugin1
project /home/me/workspace/com.inventage.project.plugin2
version com.inventage.project.* 1.2.3-SNAPSHOT

incrementMajor <artifact id pattern>

Updates the version in the projects matching the provided id pattern (use '*' as wildcard) to the next major snapshot. Also updates all dependencies in the universe.

Example

project /home/me/workspace/com.inventage.project.plugin
incrementMajor com.inventage.project.plugin

incrementMinor <artifact id pattern>

Updates the version in the projects matching the provided id pattern (use '*' as wildcard) to the next minor snapshot. Also updates all dependencies in the universe.

Example

project /home/me/workspace/com.inventage.project.plugin
incrementMinor com.inventage.project.plugin

incrementBugfix <artifact id pattern>

Updates the version in the projects matching the provided id pattern (use '*' as wildcard) to the next bugfix snapshot. Also updates all dependencies in the universe.

Example

project /home/me/workspace/com.inventage.project.plugin
incrementBugfix com.inventage.project.plugin

release <artifact id pattern>

Updates the version in the projects matching the provided id pattern (use '*' as wildcard) to the release, that is, removing any snapshot qualifiers. Also updates all dependencies in the universe.

Example

project /home/me/workspace/com.inventage.project.plugin
release com.inventage.project.plugin

snapshot <artifact id pattern>

Updates the version in the projects matching the provided id pattern (use '*' as wildcard) to the snapshot, that is, adding snapshot qualifiers, if needed. Also updates all dependencies in the universe.

Example

project /home/me/workspace/com.inventage.project.plugin
snapshot com.inventage.project.plugin

updateReferences <artifact id pattern> <version>

Searches in the universe for occurrences of the stated project (or, projects if there are more than one matches). If the occurrences match the current version of the stated project, their reference versions are updated to the provided version.

Example

project /home/me/workspace/com.inventage.project.plugin
project /home/me/workspace/com.inventage.project.depending_plugin1
project /home/me/workspace/com.inventage.project.depending_plugin2
updateReferences com.inventage.project.plugin 1.2.3

include <path>

Includes the batch file found at the provided path and executes it in the context of the current batch file.

Example

Contents of release.versiontiger:

project /home/me/workspace/com.inventage.project.plugin

Contents of another file:

include /home/me/workspace/tools/release.versiontiger
snapshot com.inventage.project.plugin

setting <key> <value>

Allows to globally set certain system properties and configuration items. We currently support the following configuration items:

  • osgi.release.qualifier: Defines the qualifier which is used on OSGI release versions. By default, this is the empty string.
  • osgi.snapshot.qualifier: Defines the qualifier which is used on OSGI snapshot versions. By default, this is 'qualifier'.

Example

setting osgi.release.qualifier release
project /home/me/workspace/com.inventage.project.plugin
release com.inventage.project.plugin

property <artifact id> <key> <value>

Writes a property into the POM file of the provided project. Besides arbitrary strings for the key and value you may also use the following variables which wrap properties of other projects in the universe.

The version of an artifact in the Maven format:

${version:my.artifact.id}

The version of an artifact in the OSGI format:

${osgiVersion:my.artifact.id}

Examples

project /home/me/workspace/com.inventage.project.plugin
property com.inventage.project.plugin myProperty myContent

The (simplified) POM file of the artifact has the following contents afterwards:

<project>
    <artifactId>com.inventage.project.plugin</artifactId>
    <version>1.2.3-SNAPSHOT</version>
    <properties>
        <myProperty>myContent</myProperty>
    </properties>
</project>

The use of the internal variables is demonstrated with this simple example:

# First, we set the version of the 'other_plugin'
project /home/me/workspace/com.inventage.project.other_plugin
version com.inventage.project.other_plugin 0.0.3

# Then, we add this version as property in the POM file of another plugin.
project /home/me/workspace/com.inventage.project.plugin
property com.inventage.project.plugin otherPluginVersion ${version:com.inventage.project.other_plugin}

The (simplified) POM file of the artifact has the following contents afterwards:

<project>
    <artifactId>com.inventage.project.plugin</artifactId>
    <version>1.2.3-SNAPSHOT</version>
    <properties>
        <otherPluginVersion>0.0.3</otherPluginVersion>
    </properties>
</project>

Sample

The following sample uses a project scenario which needs to release and snapshot from time to time. The respective commands are placed in two distinct .versiontiger files which can be called on demand.

Contents of the file projects.versiontiger:

# Universe definition
project ./../service/my.plugin1
project ./../service/my.plugin2
project ./../server/my.plugin3
project ./../server/my.plugin4
project ./../server/my.plugin5
project ./../client/my.plugin6
project ./../client/my.plugin7
# ...

Contents of the file release.versiontiger:

# Including the universe
include projects.versiontiger

# Releasing all artifacts
release my.plugin1
release my.plugin2
release my.plugin3
release my.plugin4
release my.plugin5
release my.plugin6
release my.plugin7
# ...

Contents of the file snapshot.versiontiger:

# Including the universe
include projects.versiontiger

# Snapshotting all artifacts
snapshot my.plugin1
snapshot my.plugin2
snapshot my.plugin3
snapshot my.plugin4
snapshot my.plugin5
snapshot my.plugin6
snapshot my.plugin7
# ...

To release, you now can call the following command from a project directory:

$ java -jar version-tiger-cli.jar release.versiontiger

Analogous, call the following for snapshotting the project:

$ java -jar version-tiger-cli.jar snapshot.versiontiger
Clone this wiki locally