private File buildWar ( List < ArtifactOrFile > classPathEntries ) { try { List < String > classesUrls = classPathEntries . stream ( ) . map ( ArtifactOrFile :: file ) . filter ( this :: isDirectory ) . filter ( url -> url . contains ( "classes" ) ) . collect ( Collectors . toList ( ) ) ; List < File > classpathJars = classPathEntries . stream ( ) . map ( ArtifactOrFile :: file ) . filter ( file -> file . endsWith ( ".jar" ) ) . map ( File :: new ) . collect ( Collectors . toList ( ) ) ; return WarBuilder . build ( classesUrls , classpathJars ) ; } catch ( IOException e ) { throw new RuntimeException ( "failed to build war" , e ) ; } }
builds war with classes inside