@@ -279,7 +279,8 @@ private File getRepositoryMapFile(String customRepositoryMap) {
279
279
try {
280
280
repositoryMap = locator .getResourceAsFile (customRepositoryMap );
281
281
} 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 (" " );
283
284
repositoryMap = new File (customRepositoryMap );
284
285
}
285
286
return repositoryMap ;
@@ -292,17 +293,23 @@ private File getRepositoryMapFile(String customRepositoryMap) {
292
293
* @throws MojoExecutionException
293
294
*/
294
295
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" );
304
307
}
305
308
}
309
+
310
+ if (this .xmlRepositoryMap == null ) {
311
+ this .xmlRepositoryMap = this .getClass ().getResourceAsStream ("/RepositoryMap.xml" );
312
+ }
306
313
}
307
314
308
315
/**
@@ -320,7 +327,7 @@ protected void checkRepositoryMapIsValid(File repositoryMap) throws MojoExecutio
320
327
Schema schema = schemaFactory .newSchema (schemaFile );
321
328
Validator validator = schema .newValidator ();
322
329
validator .validate (xmlFile );
323
- LOG .info (" " + xmlFile .getSystemId () + " is valid" );
330
+ LOG .info ("Repository map ' " + xmlFile .getSystemId () + "' is valid" );
324
331
LOG .info (" " );
325
332
} catch (SAXException | IOException ex ) {
326
333
throw new MojoExecutionException (repositoryMap .getName () + " is not valid: " + ex .getLocalizedMessage ());
0 commit comments