@@ -406,7 +406,7 @@ private boolean checkDependencies()
406
406
407
407
if ( !usedUndeclaredWithClasses .isEmpty () )
408
408
{
409
- getLog (). warn ( "Used undeclared dependencies found:" );
409
+ logDependencyWarning ( "Used undeclared dependencies found:" );
410
410
411
411
if ( verbose )
412
412
{
@@ -422,7 +422,7 @@ private boolean checkDependencies()
422
422
423
423
if ( !unusedDeclared .isEmpty () )
424
424
{
425
- getLog (). warn ( "Unused declared dependencies found:" );
425
+ logDependencyWarning ( "Unused declared dependencies found:" );
426
426
427
427
logArtifacts ( unusedDeclared , true );
428
428
reported = true ;
@@ -431,7 +431,7 @@ private boolean checkDependencies()
431
431
432
432
if ( !nonTestScope .isEmpty () )
433
433
{
434
- getLog (). warn ( "Non-test scoped test only dependencies found:" );
434
+ logDependencyWarning ( "Non-test scoped test only dependencies found:" );
435
435
436
436
logArtifacts ( nonTestScope , true );
437
437
reported = true ;
@@ -500,7 +500,7 @@ private void logArtifacts( Set<Artifact> artifacts, boolean warn )
500
500
501
501
if ( warn )
502
502
{
503
- getLog (). warn ( " " + artifact );
503
+ logDependencyWarning ( " " + artifact );
504
504
}
505
505
else
506
506
{
@@ -526,10 +526,10 @@ private void logArtifacts( Map<Artifact, Set<String>> artifacts, boolean warn )
526
526
527
527
if ( warn )
528
528
{
529
- getLog (). warn ( " " + entry .getKey () );
529
+ logDependencyWarning ( " " + entry .getKey () );
530
530
for ( String clazz : entry .getValue () )
531
531
{
532
- getLog (). warn ( " class " + clazz );
532
+ logDependencyWarning ( " class " + clazz );
533
533
}
534
534
}
535
535
else
@@ -545,6 +545,18 @@ private void logArtifacts( Map<Artifact, Set<String>> artifacts, boolean warn )
545
545
}
546
546
}
547
547
548
+ private void logDependencyWarning ( CharSequence content )
549
+ {
550
+ if ( failOnWarning )
551
+ {
552
+ getLog ().error ( content );
553
+ }
554
+ else
555
+ {
556
+ getLog ().warn ( content );
557
+ }
558
+ }
559
+
548
560
private void writeDependencyXML ( Set <Artifact > artifacts )
549
561
{
550
562
if ( !artifacts .isEmpty () )
0 commit comments