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]