Lacking any other solution I went ahead and incorporated an internal Maven
property that gets set at the end of the first code generation in the
lifecycle. That way subsequent checks of the property provide an indication
to skip code generation.

This seems kind of kludgy but it works ....



stug23 wrote:
> 
> As a clarification, the execution that I am trying to avoid is the second
> execution of a code generator mojo that is bound to generate-sources
> phase.
> 
> The second execution results from uses the maven-sources-plugin which
> states:
> 
> "Invokes the execution of the lifecycle phase generate-sources prior to
> executing itself."
> 
> The information above is from the following reference:
> 
>     <http://maven.apache.org/plugins/maven-source-plugin/jar-mojo.html>
> 
> So my question is: "Is there a way to still produce a sources jar using
> the maven-source-plugin without invoking execution of the generate-sources
> phase?"
> 
> It doesn't make sense to me that this invocation cannot be switched off
> since the code generation has already taken place and  it's not very
> efficient to perform code generation all over again in a subsequent
> lifecycle phase. Perhaps there are cases where this is needed, but mine is
> not one of them, so I am hoping that someone can help me to disable this
> feature of the maven-source-plugin.
> 
> TIA
> 
> 
> 
> 
> stug23 wrote:
>> 
>> I am working on a code generator plugin that ends up being executed
>> multiple times when in fact I only want it to execute once in the
>> generate-sources phase.
>> 
>> According to this posting
>> <http://www.mail-archive.com/users@maven.apache.org/msg78484.html> this
>> is an expected behavior.
>> 
>> How do I avoid multiple executions of my code generator which needs to
>> run in the generate-sources phase?
>> 
>> TIA
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Multiple-executions-of-goals-under-generate-sources%3A-How-to-avoid--tp20038097p20057662.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to