Fix MavenSettings’ handling of profiles activated by a file

Previously, MavenSettings used a FileProfileActivator with no
PathTransformer. If a settings.xml file contains a file-activated
profile this would result in an NPE within Maven. This was made worse
by the NPE not being included in the resulting failure message which
hampered diagnosis of the problem.

This commit updates MavenSettings to configure its FileProfileActivator
with a PathTransformer. It also improves the failure message that’s
created from any problems that are reported by Maven while determining
the active profiles to include a problem’s exception if it has one.

Closes gh-4826
This commit is contained in:
Andy Wilkinson
2016-01-18 13:18:03 +00:00
parent 7d975ecd2e
commit c4f756daee
2 changed files with 57 additions and 4 deletions

View File

@@ -28,4 +28,21 @@
</proxy>
</proxies>
</settings>
<profiles>
<profile>
<id>test-profile</id>
<activation>
<file>
<exists>${user.home}/.m2/some_file</exists>
</file>
</activation>
<repositories>
<repository>
<id>example-repository</id>
<url>http://repo.example.com</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>