@@ -279,7 +279,8 @@ private File getRepositoryMapFile(String customRepositoryMap) {
279279 try {
280280 repositoryMap = locator .getResourceAsFile (customRepositoryMap );
281281 } catch (ResourceNotFoundException | FileResourceCreationException e ) {
282- LOG .info ("Unable to find the specified custom repository map, attempting to use value as a file path...\n " );
282+ LOG .info ("Unable to find the specified custom repository map in dependencies, attempting to use value as a file path..." );
283+ LOG .info (" " );
283284 repositoryMap = new File (customRepositoryMap );
284285 }
285286 return repositoryMap ;
@@ -292,17 +293,23 @@ private File getRepositoryMapFile(String customRepositoryMap) {
292293 * @throws MojoExecutionException
293294 */
294295 private void setRepositoryMapFile () throws MojoExecutionException {
295- File repositoryMap = getRepositoryMapFile (this .customRepositoryMap );
296- if (repositoryMap == null || !repositoryMap .exists ()) {
297- this .xmlRepositoryMap = this .getClass ().getResourceAsStream ("/RepositoryMap.xml" );
298- } else {
299- checkRepositoryMapIsValid (repositoryMap );
300- try {
301- this .xmlRepositoryMap = repositoryMap .toURI ().toURL ().openStream ();
302- } catch (IOException ioe ) {
303- throw new MojoExecutionException (ioe .getLocalizedMessage ());
296+ if (this .customRepositoryMap != null && !this .customRepositoryMap .isEmpty ()) {
297+ File repositoryMap = getRepositoryMapFile (this .customRepositoryMap );
298+ if (repositoryMap .exists ()) {
299+ checkRepositoryMapIsValid (repositoryMap );
300+ try {
301+ this .xmlRepositoryMap = repositoryMap .toURI ().toURL ().openStream ();
302+ } catch (IOException ioe ) {
303+ throw new MojoExecutionException (ioe .getLocalizedMessage ());
304+ }
305+ } else {
306+ throw new MojoExecutionException ("Repository map '" + repositoryMap .getAbsolutePath () + "' does not exist" );
304307 }
305308 }
309+
310+ if (this .xmlRepositoryMap == null ) {
311+ this .xmlRepositoryMap = this .getClass ().getResourceAsStream ("/RepositoryMap.xml" );
312+ }
306313 }
307314
308315 /**
@@ -320,7 +327,7 @@ protected void checkRepositoryMapIsValid(File repositoryMap) throws MojoExecutio
320327 Schema schema = schemaFactory .newSchema (schemaFile );
321328 Validator validator = schema .newValidator ();
322329 validator .validate (xmlFile );
323- LOG .info (" " + xmlFile .getSystemId () + " is valid" );
330+ LOG .info ("Repository map ' " + xmlFile .getSystemId () + "' is valid" );
324331 LOG .info (" " );
325332 } catch (SAXException | IOException ex ) {
326333 throw new MojoExecutionException (repositoryMap .getName () + " is not valid: " + ex .getLocalizedMessage ());
0 commit comments