[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] <runOnConfiguration> and copying resources
|
On Oct 22, 2012, at 10:51 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> Again, your plugin must not generate any output resources if its inputs
> have not changes according to BuildContext. In the case of configuration
> build, BuildContext is empty, so the plugin is expected to skip output
> resources generation.
This is still not a clear response, because it assumes we can determine "inputs" with an incompletely configured project (e.g. where maven-resources-plugin has not run). But many plugins will throw exceptions on an incompletely configured build, and you haven't told us what to do for those exceptions.
Two specific proposals have been presented that deal with the whole problem. Could you look at them and tell us which you recommend? (Or if you recommend some other way of dealing with errors?) I've copied them below. The first is from me (Steven Bethard) and the second is from Josh Beitelspacher.
On Oct 19, 2012, at 11:54 AM, Steven Bethard <Steven.Bethard@xxxxxxxxxxxx> wrote:
> So here's what I'm thinking now:
>
> (1) During the search for files with hasDelta=true, I should ignore any errors that come up in the search, and interpret those errors as hasDelta=false. That way, on an import/configuration build, I always only come up with hasDelta=false.
>
> (2) In the case that I do find a hasDelta=true file, then I can restart the search for input files, and if any errors happen now, they're real errors that should be reported, not ignored. Assuming no errors occur, I can then run the code generation as usual.
On Oct 22, 2012, at 10:33 AM, Josh Beitelspacher <josh@xxxxxxxxxxxxx> wrote:
> I think I just found a much cleaner way to detect the configuration
> build. This looks like a good pattern to follow:
>
> // add generated source and/or resource directories to the project
>
> // generated source directories will be added as optional classpath
> entries, so they don't need to be created
> // generated resources directories must exist, so create them here
>
> // if this is an m2e configuration build then return immediately
> without doing any work
> if (buildContext.isIncremental() &&
> !buildContext.hasDelta(project.getBasedir())) {
> return;
> }
>
> // perform code and/or resource generation
Thanks,
Steve