Hi,

I just came across this issue the other day, too. A mvn install after a
mvn clean install, i.e. nothing has to be compiled, results in a jar
being created for one module which takes one minute. This is due to
filtered resources being overwriten though this is not necessary. This
happens for multiples modules in our build. I too think that the speed
of the build process could be greatly improved if resources wouldn't be
overwriten if nothing has changed.

> I think we’re doomed to having to recreate the file each time, because we 
> have no way of knowing whether the file has changed until you generate it.

I'm new to Maven and just discovering it, but my sketch of a naive and
simple, not optimized idea was the following:

- Identify all locations where information can be stored which is used
to generate filtered resources (pom.xml, .properties files, ...?)
- For all these locations, get the date it was last written to
- Take the most recent date from all these dates
- For each filtered resource which is already in the target folder from
the last build, take the date of this resource file and check if this
date is newer than the date identified in the previouis step. If it is,
don't copy the filtered resource to the target folder

Is this not possible?

I'd also like to add that I found a similar thread when searching for
this issue:
https://users.maven.apache.narkive.com/FAqDGEfS/avoiding-overwriting-newer-file-when-using-maven-resources-plugin-copy-resources-with-filtering

Best regards
Tobias



On 2020/04/25 13:58:15, Karl Heinz Marbaise <k...@gmx.de> wrote:
> Hi,>
>
> On 25.04.20 00:58, Robert Oxspring wrote:>
> > Hi all,>
> >>
> >>
> > When copying resources with filtering on, files are always
overwritten even when the filters have not changed. I’d like to change
this such that repeated filtering copies do not modify the destination
file.>
> >>
> > I’ve prepared a change to write the filtered content to a temporary
file and only rename that over the destination if they’re different:>
> >
https://github.com/apache/maven-filtering/compare/master...roxspring:feature/avoid-overwrite-on-no-op-filter>

> >>
> > Would something like this be acceptable? I’m guessing the next step
is to create an issue in Jira? - agains MNG??>
>
> There is a JIRA link on the github repository ...creating a JIRA is a>
> prerequisites..>
>
> Maven Filtering is a component which is used by>
> maven-resources-plugin...If you like to make that effort would be great>
> and see if all tests working fine ...and maybe we will merge that...>
>
> Kind regards>
> Karl Heinz Marbaise>
>
>
> >>
> > Thanks,>
> >>
> > Rob>
> > --------------------------------------------------------------------->
> > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org>
> > For additional commands, e-mail: dev-h...@maven.apache.org>
> >>
>
> --------------------------------------------------------------------->
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org>
> For additional commands, e-mail: dev-h...@maven.apache.org>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to