Hi Ashley,

as you configure more plugins to run, each of which could
generate source files, you may at some point run into
two plugins that use the same directory. In that case you need to
go and configure at least one of them to avoid the clash.

To avoid such clashes in general it would thus be wise to use

${project.build.directory}/generated-sources/${plugin-prefix}

which would keep output of each plugin separated.

Regards
Mark Donszelmann


> -----Original Message-----
> From: Ashley Williams [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 15, 2005 1:51 PM
> To: Maven Users List
> Subject: Re: [m2] Standard directory layout for generated sources
> 
> Hi John,
> 
> Any reason why each plugin has to generate its sources into 
> its own plugin-prefix root directory?
> After all as I add class after class and package after 
> package into the src directory I don't feel the need to start 
> lots of new top level directories.
> 
> In fact if it wasn't for the fact that I wanted to be able to 
> do a clean, I would have put the generated sources in the src 
> directory as there is otherwise nothing special about them. 
> The only pollution I can think of is if you wanted to do a 
> fine-grained clean on just one plugin - but maybe I'm not 
> thinking very hard!
> 
> Of course if this is to become the standard for maven then I 
> am happy to do this also.
> 
> - Ashley
> 
> On 14 Dec 2005, at 18:46, John Casey wrote:
> 
> > We already have some default "standards" for generation of code.  
> > First, code should be generated into:
> >
> > ${project.build.directory}/generated-sources/${plugin-prefix}
> >
> > Correspondingly, generated resources would go in:
> >
> > ${project.build.directory}/generated-resources/${plugin-prefix}
> >
> > This accommodates multiple code generators within the same build 
> > process, with no pollution of one by another. Tracking these new 
> > source/resource locations is easy; in your plugin, simply call:
> >
> > project.addCompileSourceRoot(..);
> > project.addResource(..);
> >
> > Of course, we also define analogous structures for test sources/ 
> > resources.
> >
> > We've found in the past that this offers a pretty good compromise 
> > between a clean structure per generating plugin, and simplicity of 
> > directory layouts. The full-scale src/(main|test)/(java|resources) 
> > directory structure isn't that useful in this case, since the 
> > generated sources/resources will not have to be maintained.
> >
> > HTH,
> >
> > John
> >
> > Dário Luís Coneglian Oliveros wrote:
> >> Hi Jochen,
> >> One way to avoid the problem you mentioned is to have 
> something like:
> >> - target
> >>   - generated
> >>     - src
> >>       - main
> >>      - java
> >>         - resources
> >>       - test
> >>         - java
> >>    ...
> >>    
> >> This way we would keep a similar Maven directory layout for the 
> >> generated files.
> >> [Jochen] Why do you need to tell the compiler that there is a new 
> >> source directory? This is the plugins task and it should do so 
> >> automatically?
> >> [Dário] In case we use plugins such as ejbdoclet, 
> hibernatedoclet and 
> >> so on. When using any of these, you end up having your files 
> >> generated somewhere. Thus you need to tell Maven where to 
> find them 
> >> in order to compile them. Having a standard layout for generated 
> >> files, this setting could be defined implicitly. Do you know how a 
> >> plugin could tell Maven on the fly about the existence of a new 
> >> source directory ? If this is possible, then a plugin 
> could have its 
> >> own generated directory and inform it to Maven.
> >> Despite I still think it would be great to have a standard 
> directory 
> >> layout for generated files.
> >> Regards,
> >> Dário
> >> -----Original Message-----
> >> From: Jochen Wiedmann [mailto:[EMAIL PROTECTED]
> >> Sent: quarta-feira, 14 de dezembro de 2005 09:32
> >> To: Maven Users List
> >> Subject: Re: [m2] Standard directory layout for generated 
> sources On 
> >> 12/14/05, Dário Luís Coneglian Oliveros <[EMAIL PROTECTED]>
> >> wrote:
> >>> When looking at the standard layout directory, I thought 
> it would be 
> >>> great to have a common directory for the generated sources also 
> >>> since Maven already has a generate-sources lifecycle phase.
> >>> This way we don´t need to tell the compiler where to find the 
> >>> generated sources.
> >> I disagree. First of all, a single directory woudn't be sufficient:
> >> For example, you generate not only sources, but also 
> resources. Both 
> >> may be generated for tests as well. So we end up with 
> four. Besides, 
> >> it is not unusual to process one generators files with another 
> >> generator. In other words, the formers output directory 
> becomes the 
> >> latters input directory.
> >> But, what makes me wonder the most: Why do you need to tell the 
> >> compiler that there is a new source directory? This is the plugins 
> >> task and it should do so automatically?
> >> Jochen
> >> --
> >> Often it does seem a pity that Noah and his party did not miss the 
> >> boat. (Mark Twain)
> >> 
> ---------------------------------------------------------------------
> >> 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]
> 
> 

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

Reply via email to