You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Aleksei Valikov <va...@gmx.net> on 2006/06/17 10:52:24 UTC
Maven questions: defaulting an array in Mojo, executing generated
unit tests
Hi.
1. When developing a plugin, how would it be possible to provide a default
expression for an array?
For instance, I have a field like:
protected String[] bindingIncludes;
I'd like the it to be an array of single "*.xjb" string.
2. I have a Java code generation plugin which may also produce some unit tests.
Everything is put into target/generated-sources/xjc, for some technical reasons
I can't output unit tests into a different directory. How could I instruct Maven
to execute the generated unit tests from target/generated-sources/xjc?
Thank you for your time.
Bye.
/lexi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven questions: defaulting an array in Mojo, executing generated
unit tests
Posted by Edwin Punzalan <ep...@exist.com>.
For #2, your plugin should call project.addTestCompileSourceRoot and
point it to "target/generated-sources/xjc".
That will enable the compiler plugin to compile those test sources in
there and put the compiled classes in target/test-classes which then
allows the surefire to run them.
Hope that helps.
^_^
Aleksei Valikov wrote:
> Hi.
>
> 1. When developing a plugin, how would it be possible to provide a
> default expression for an array?
> For instance, I have a field like:
>
> protected String[] bindingIncludes;
>
> I'd like the it to be an array of single "*.xjb" string.
>
> 2. I have a Java code generation plugin which may also produce some
> unit tests. Everything is put into target/generated-sources/xjc, for
> some technical reasons I can't output unit tests into a different
> directory. How could I instruct Maven to execute the generated unit
> tests from target/generated-sources/xjc?
>
> Thank you for your time.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven questions: defaulting an array in Mojo, executing generated
unit tests
Posted by Edwin Punzalan <ep...@exist.com>.
Hi, Tim.
setting the <testSourceDirectory> will work if you don't have any other
test sources in src/test/java... otherwise, you should use
project.addTestCompileSourceRoot
Tim Kettler wrote:
> Aleksei Valikov schrieb:
>> Hi.
>>
>> 1. When developing a plugin, how would it be possible to provide a
>> default expression for an array?
>> For instance, I have a field like:
>>
>> protected String[] bindingIncludes;
>>
>> I'd like the it to be an array of single "*.xjb" string.
>
> See this thread:
> http://www.mail-archive.com/users@maven.apache.org/msg42055.html
>
>> 2. I have a Java code generation plugin which may also produce some
>> unit tests. Everything is put into target/generated-sources/xjc, for
>> some technical reasons I can't output unit tests into a different
>> directory. How could I instruct Maven to execute the generated unit
>> tests from target/generated-sources/xjc?
>
> You can set the directory for test sources in your pom:
>
> <build>
> <testSourceDirectory>target/generated-sources/xjc</testSourceDirectory>
> </build>
>
> In the case you want to further customize the surefire-plugin
> configuration have a look at the plugins site at:
> http://maven.apache.org/plugins/maven-surefire-plugin
>
> especially the test mojo configuration page:
> http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html
>
>>
>> Thank you for your time.
>>
>> Bye.
>> /lexi
>
> Hope this helps
> -Tim
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven questions: defaulting an array in Mojo, executing generated
unit tests
Posted by Tim Kettler <ti...@udo.edu>.
Aleksei Valikov schrieb:
> Hi.
>
> 1. When developing a plugin, how would it be possible to provide a
> default expression for an array?
> For instance, I have a field like:
>
> protected String[] bindingIncludes;
>
> I'd like the it to be an array of single "*.xjb" string.
See this thread:
http://www.mail-archive.com/users@maven.apache.org/msg42055.html
> 2. I have a Java code generation plugin which may also produce some unit
> tests. Everything is put into target/generated-sources/xjc, for some
> technical reasons I can't output unit tests into a different directory.
> How could I instruct Maven to execute the generated unit tests from
> target/generated-sources/xjc?
You can set the directory for test sources in your pom:
<build>
<testSourceDirectory>target/generated-sources/xjc</testSourceDirectory>
</build>
In the case you want to further customize the surefire-plugin configuration have a look at
the plugins site at:
http://maven.apache.org/plugins/maven-surefire-plugin
especially the test mojo configuration page:
http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html
>
> Thank you for your time.
>
> Bye.
> /lexi
Hope this helps
-Tim
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org