maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From motes motes <mort.mo...@gmail.com>
Subject Calling versions plugin from code?
Date Wed, 27 Mar 2013 12:24:16 GMT
I am writing a java class where I need to use the
versions-maven-plugin to basically do what I normally do from command
line:

mvn versions:set -DnewVersion=1.0.1-SNAPSHOT

Having maven installed locally (and on the path) is not an option. In
a project I have added:

		<dependency>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>versions-maven-plugin</artifactId>
			<version>2.0</version>
		</dependency>

an started work on at test:

    SetMojo ss = new SetMojo();
    Model model = new Model();
    MavenProject project = new MavenProject(model);
    project.setFile(new File("test/pom.xml"));
    ss.setProject(project);
    try {
      ss.execute();
    } catch (MojoExecutionException e) {
      e.printStackTrace();
    } catch (MojoFailureException e) {
      e.printStackTrace();
    }

But it could be nice with some examples/unit tests that shows how to
do this the right way. Any recommendations for this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message