works for me:
./pom.xml:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>testplugin</groupId>
<artifactId>testplugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.7</version>
</dependency>
</dependencies>
</project>
./src/main/java/TestMojo.java:
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
/**
* @goal test
*/
public class TestMojo extends AbstractMojo
{
/**
* Project instance
* @parameter default-value="${project}"
*
*/
private MavenProject project;
public void execute() throws MojoExecutionException
{
}
}
-Tim
Christian Clauss schrieb:
Hi,
I have declared the dependency to:
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.7</version>
in my pom but it still doesn't work.
My usecase that forces me to alter the project version, is a custom release build. I want the release build not to build all the sources again, but just change the name of a SNAPSHOT version. After that the version in the pom should be automatically altered and counted up to the next -SNAPSHOT version.
I hope my explanation is coherent.
-Christian
-----Ursprüngliche Nachricht-----
Von: Tim Kettler [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 2. Juli 2007 11:03
An: Maven Users List
Betreff: Re: Change project version
Hi,
well, most probably the class just isn't in your classpath.
Have you declared a dependency to:
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.7</version>
in your pom?
And if you don't mind: May I ask what your usecase is that forces you to
alter the project version?
-Tim
Christian Clauss schrieb:
Hello everybody,
I would like to change the version in the pom.xml using a self-developed
plug-in. I tried to get access via
/**
* Project instance
* @parameter default-value="${project}"
*
*/
private MavenProject project;
and then
project.setVersion("222");
but it doesn't work. The compiler tells me that MavenProject is an
unknown type: can't find the symbol: class MavenProject
Does anyone have a clue what to do?
Thanks a lot.
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]