You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2006/06/16 21:50:51 UTC
More questions on maven-plugin-testing-harness
Hi,
thanks to Odea's help, I managed to get a few steps further. However, I have
to return with another question in the end.
My plugin contains the following variable:
/**
* The base directory, relative to which directory names are
* interpreted.
*
* @parameter expression="${basedir}"
* @required
* @readonly
*/
public File basedir;
The plugin is started with the following code:
public void testIt1() throws Exception
{
File testPom = new File( getBasedir(), "src/test/it1/pom.xml" );
ValidatorMojo vm = (ValidatorMojo) lookupMojo( "validate", testPom );
vm.execute();
}
However, the plugins execution fails, because basedir is null. I have
attempted to gain the base directory through a variable "project" of type
MavenProject, which is initialized with ${project}, but this one is also null.
Any ideas?
Regards,
Jochen
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: RE : More questions on maven-plugin-testing-harness
Posted by Jochen Wiedmann <jo...@gmail.com>.
Olivier Lamy wrote:
> setVariableValueToObject( vm , "basedir", new File( getBasedir() ) );
> Before vm.execute();
Thanks, that worked like a charm!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE : More questions on maven-plugin-testing-harness
Posted by Olivier Lamy <ol...@accor.com>.
Try
setVariableValueToObject( vm , "basedir", new File( getBasedir() ) );
Before vm.execute();
Take care getBaseDir() will point to your current project basedir.
If you use a test project located in
${basedir}/src/test/resources/projects/simple/simple-pom.xml
You will probably need to use something like (not tested) :
setVariableValueToObject( vm , "basedir", new File( getBasedir(),
"target/test-classes/projects/simple" ) );
--
Olivier
-----Message d'origine-----
De : Jochen Wiedmann [mailto:jochen.wiedmann@gmail.com]
Envoyé : vendredi 16 juin 2006 21:51
À : Maven Users List
Objet : More questions on maven-plugin-testing-harness
Hi,
thanks to Odea's help, I managed to get a few steps further. However, I
have
to return with another question in the end.
My plugin contains the following variable:
/**
* The base directory, relative to which directory names are
* interpreted.
*
* @parameter expression="${basedir}"
* @required
* @readonly
*/
public File basedir;
The plugin is started with the following code:
public void testIt1() throws Exception
{
File testPom = new File( getBasedir(), "src/test/it1/pom.xml" );
ValidatorMojo vm = (ValidatorMojo) lookupMojo( "validate",
testPom );
vm.execute();
}
However, the plugins execution fails, because basedir is null. I have
attempted to gain the base directory through a variable "project" of
type
MavenProject, which is initialized with ${project}, but this one is also
null.
Any ideas?
Regards,
Jochen
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
This e-mail, any attachments and the information contained therein ("this message") are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited.
**********************************************************************
Ce message électronique et tous les fichiers joints ainsi que les informations contenues dans ce message ( ci après "le message" ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites.
**********************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org