webjars/webjars-locator — pull request #23 by mwanji (2013-07-04 08:36:09+00:00)
Title: WebJarAssetResolver allows custom asset matching behaviour

I ran into issues with the wro4j-maven-plugin (described [here](https://github.com/alexo/wro4j/issues/131#issuecomment-20117814)) with duplicate webjars on the classpath because the plugin's classloader contains jars which are ultimately excluded from the project's classpath. This might be fixable with classpath wizardry, but this solution seems simpler and more widely useful.

The WebJarAssetResolver interface basically takes candidates that match a partial path and decides which one to return, or throws an exception if it's not happy. Constructors have been added to WebJarAssetLocator to set it.

The EXACTLY_ONE implementation is used by default and reproduces the current behaviour. In wro4j-maven-plugin's case, I created another implementation that chooses the most recent version of the asset, when several are present.