elharo opened a new pull request, #171: URL: https://github.com/apache/maven-resolver-ant-tasks/pull/171
Fixes #166 ## Problem `AntRepoSys.getRemoteRepositories()` threw a `NullPointerException` when `settings.xml` declared an `activeProfile` that was not defined by any `<profile>` in the file (for example a profile defined only in a POM). Maven's `DefaultSettingsBuilder` keeps such ids in the effective settings' `activeProfiles` list without validating them, so `settings.getProfilesAsMap().get(profileId)` returns `null` and `profile.getRepositories()` crashed. ## Fix Log a warning and skip undefined active profiles instead of crashing. Profiles that are defined in `settings.xml` keep working as before. ## Test New `ActiveProfileTest` reproduces the crash: a `settings.xml` with one defined profile and one `activeProfile` that is not defined anywhere. Before the fix it fails with the NPE above; after the fix the build succeeds, the undefined profile is skipped with a warning, and the defined profile's repository is still registered. All 54 tests pass (`mvn verify`). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
