Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] <runOnConfiguration> and copying resources

On Oct 23, 2012, at 3:46 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> I recommend NOT to perform any output generation if
> buildContext.hasDelta returns false for any (potential) input. All
> plugins I've seen either watch specific files or all files under
> specific directories, so the plugin just needs to check if
> buildContext.hasDelta is false for the files/directories it watches.
> 
> If your plugin has more complicated input location logic, then I
> recommend writing an m2e project configurator to code configuration and
> build code paths separately.

Yes, my plugin has more complicated input location logic - it uses the classpath to determine the locations.

Did you have any comments on the two approaches that have been suggested? Would either of these work?

Steve

> 
> --
> Regards,
> Igor
> 
> On 12-10-23 7:06 PM, Steven Bethard wrote:
>> 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
>> _______________________________________________
>> m2e-dev mailing list
>> m2e-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>> 
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-dev



Back to the top