Re: Execution control for self developed maven plugins

2011-11-15 Thread Stephen Connolly
execute the process-resources phase... but beware if you are binding your
plugin to the lifecycle you would be better giving the default phase as
process-resources rather than forking a lifecycle with @execute

On 15 November 2011 10:28, Jan Bernhardt  wrote:

>  ** **
>
> Hi,
>
> ** **
>
> how can I ensure that resource filtering took place before my maven plugin
> is executed?
>
> ** **
>
> Background:
>
> I wrote my own maven plugin. I used spring to wire my components together
> and set specific configuration parameters.
>
> Now I would like to use maven properties in my spring-config.xml. I put my
> spring-config.xml into src/main/resources/ and used ${maven.property}
> placeholders.
>
> In my plugin I now want to read the spring-config.xml which contains the
> values from my pom.xml file instead of my placeholders.
>
> I used the following code to access this config file in my plugin:
>
> ** **
>
> /**
>
> * @parameter expression="${spring.config}"
> default-value="${project.build.outputDirectory}${file.separator}spring-config.xml"
> 
>
> * @required
>
> */
>
> private String config;
>
> ** **
>
> ** **
>
> But because the target sources have not been generated yet, I get a
> FileNotFoundException when I try to read this config file.
>
> I read something about an “@execute” Annotation which executes another
> plugin first, before executing the current plugin. But I don’t know how to
> set it right, that filtering takes place before my plugin is executed. I
> tried, but it didn’t work:
>
> ** **
>
> @execute goal=”resources:resources”
>
> ** **
>
> Kind regards
> Jan
>
> ** **
>
> ** **
>
> Jan Bernhardt, M.Sc., +49 (228) 76 37 76 - 15, Talend, global leader in
> Open Source Integration
>
>  
>
> [image: Description: sig_businesscard] 
> [image:
> Description: 
> sig_direction][image:
> Description: 
> sig_download]
> 
>
> [image: Description: sig_talend] 
>
> ** **
>
> 
>


Execution control for self developed maven plugins

2011-11-15 Thread Jan Bernhardt

Hi,

how can I ensure that resource filtering took place before my maven plugin is 
executed?

Background:
I wrote my own maven plugin. I used spring to wire my components together and 
set specific configuration parameters.
Now I would like to use maven properties in my spring-config.xml. I put my 
spring-config.xml into src/main/resources/ and used ${maven.property} 
placeholders.
In my plugin I now want to read the spring-config.xml which contains the values 
from my pom.xml file instead of my placeholders.
I used the following code to access this config file in my plugin:

/**
* @parameter expression="${spring.config}" 
default-value="${project.build.outputDirectory}${file.separator}spring-config.xml"
* @required
*/
private String config;


But because the target sources have not been generated yet, I get a 
FileNotFoundException when I try to read this config file.
I read something about an "@execute" Annotation which executes another plugin 
first, before executing the current plugin. But I don't know how to set it 
right, that filtering takes place before my plugin is executed. I tried, but it 
didn't work:

@execute goal="resources:resources"

Kind regards
Jan


Jan Bernhardt, M.Sc., +49 (228) 76 37 76 - 15, Talend, global leader in Open 
Source Integration



[Description: sig_businesscard][Description: 
sig_direction][Description:
 sig_download]

[Description: sig_talend]