Skip to content
Krzysztof Rzymkowski edited this page Sep 10, 2013 · 1 revision

The Maven yamlpom plugin is meant to be used both from the command line, and as part of the lifecycle.

Using the plugin on the command line

Add this to your pom.xml:

<pluginRepositories>
	<pluginRepository>
		<id>twdata-m2-repository</id>
		<name>twdata.org Maven 2 Repository</name>
		<url>http://twdata-m2-repository.googlecode.com/svn/</url>
	</pluginRepository>
</pluginRepositories>

and this to your settings.xml:

<settings>
	<pluginGroups>
		<pluginGroup>org.twdata.maven</pluginGroup>
		... other groups ...
	</pluginGroups>
	...
</settings>

Now, you should be able to run the sync goal from the command line:

mvn yamlpom:sync

Which basically is just a shorthand for the full command (for the full command, you won't need to make any changes to your settings.xml):

mvn org.twdata.maven:maven-yamlpom-plugin:sync

Interactions with your SCM

It is recommended you add the following yaml files to your scm's ignore list (.gitignore for git, svn:ignore for Subversion, etc):

  • pom.yml
  • .pom.yml

Technically, you don't have to hide them from your scm, but a) they can change a lot, polluting your commits and b) they won't stay sync'ed when using the Maven release plugin.

Keeping the pom.yml automatically in sync

If you want to add the sync to your default lifecycle, add this to your pom.yml:

build:
  plugins:
    - groupId: org.twdata.maven
      artifactId: maven-yamlpom-plugin
      version: 0.3
      executions:
        - goals: [ sync ]