[prev in list] [next in list] [prev in thread] [next in thread]
List: maven-user
Subject: Re: Calling versions plugin from code?
From: Baptiste MATHUS <bmathus () batmat ! net>
Date: 2013-03-28 9:06:26
Message-ID: CANWgJS5cqHZZrKpBPofmN+j4wdxFSs7z8vtZ+F3SB3zTGhs2EQ () mail ! gmail ! com
[Download RAW message or body]
Hi,
Plugins run in a managed environment, parameters are injected, etc.
So instantiating the mojos manually is not going to working.
You should have a look at maven embedder.
Cheers
2013/3/27 motes motes <mort.motes@gmail.com>
> 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
>
>
--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic