Skip to content

[MSHARED-1285] DefaultMavenResourcesFiltering uses BuildContext in a way that fails sometimes #270

@jira-importer

Description

@jira-importer

Christoph Läubrich opened MSHARED-1285 and commented

The maven resources plugin uses https://github.com/apache/maven-filtering/blob/master/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java to copy resources, but that component has some subtile flaws reported here:

eclipse-m2e/m2e-core#1468

The problematic part is the usage of BuildContext#newScanner that already mentions in the javadoc that passing ignoreDelta to neScanner might not reveal all required items +for copy-resources+ form A -> B and instead BuildContext#isUpTodate should be used.

Just from a quick look I assume that part of code actually wants to use something like this:

DirectoryScanner ds = new DirectoryScanner() {
  @Override
  protected boolean isSelected(String name, File file) {
    if (file.isFile() && buildContext.isUptodate(getTargetFile(file), file)) { 
     return false;
    }
    return true;
  }
};
ds.setBasedir(basedir); 

That way all the code that currently checks for if output directory existed before can also be removed what is another issue because it leads to a full resources copy even if source+target are already even if a single class file is changed while the idea seems more that if the output was not there it should not try to be incremental!


Remote Links:

5 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority:majorMajor loss of function

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions