I have developed a plugin that makes keeping versions of related but
not quite tightly coupled in sync a lot easier.

How do I go about contributing this to mojo?

-Stephen

FYI here's how it works...

In your pom you probably have a property used to define the version in
one place, for example:

<project>
  ...
  <dependencyManagement>
    <dependency>
      <groupId>blah</groupId>
      <artifactId>blah-core</artifactId>
      <version>${blah.version}</version>
    </dependency>
    <dependency>
      <groupId>blah</groupId>
      <artifactId>blah-logging</artifactId>
      <version>${blah.version}</version>
    </dependency>
    <dependency>
      <groupId>blah</groupId>
      <artifactId>blah-reporting</artifactId>
      <version>${blah.version}</version>
    </dependency>
  </dependencyManagement>
  ...
  <properties>
    <blah.version>1.3.4</blah.version>
  </properties>
  ...
</project>

That way you can update the version in one place and not forget any of them.

My plugin... which I'm calling properties-maven-plugin for now (if
somebody has a better name, I'm more than welcome to hear it)

allows you to define what artifact to base property values off... so if we added

...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <configuration>
          <linkedItems>
            <linkedItem>
              <property>blah.version</property>
              <groupId>blah</groupId>
              <artifactId>blah-core</artifactId>
            </linkedItem>
          </linkedItems>
        </configuration>
      </plugin>
      ...
    </plugins>
    ...
  </build>
...

Then by running "mvn properties:use-latest" will rewrite the pom so
that blah.version is the latest version available to you while "mvn
properties:use-latest-releases" will rewrite the pom so that
blah.version is the latest non -SNAPSHOT version available.

You could then run a build and see if everything is OK before finally
doing a checkin using the scm plugin!

The plugin also has two other goals...

"mvn properties:use-latest-parent" which will update the parent of any
project who's parent is not in the reactor to the latest version
available to you, while "mvn properties:use-latest-parent-release"
will update to the latest non -SNAPSHOT.
Note: this will only affect projects who's parent is external to the
reactor (for example a corporate pom)

Oh... and if you want to prevent jumping too high in versions or too
low, it supports adding a version specification to limit things.

e.g.
            <linkedItem>
              <property>blah.version</property>
              <groupId>blah</groupId>
              <artifactId>blah-core</artifactId>
              <version>[1.3.2,1.4.0-!)</version>
            </linkedItem>

will only update blah.version within the 1.3 stream and must update to
at least 1.3.2

If a matching version cannot be found it will leave things as they are.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to