protected String findWar ( String ... paths ) { if ( paths != null ) { for ( String path : paths ) { if ( path != null ) { File file = new File ( path ) ; if ( file . exists ( ) ) { if ( file . isFile ( ) ) { String name = file . getName ( ) ; if ( isWarFileName ( name ) ) { return file . getPath ( ) ; } } if ( file . isDirectory ( ) ) { // lets look for a war in this directory File [ ] wars = file . listFiles ( ( dir , name ) -> isWarFileName ( name ) ) ; if ( wars != null && wars . length > 0 ) { return wars [ 0 ] . getPath ( ) ; } } } } } } return null ; }
Strategy method where we could use some smarts to find the war using known paths or maybe the local maven repository?