public void execute ( ) throws MojoExecutionException { if ( ! featuresDirectory . exists ( ) ) { throw new MojoExecutionException ( "Features directory does not exist" ) ; } final Collection < File > featureFiles = listFiles ( featuresDirectory , new String [ ] { "feature" } , true ) ; final List < File > sortedFeatureFiles = new NameFileComparator ( ) . sort ( new ArrayList < File > ( featureFiles ) ) ; createOutputDirIfRequired ( ) ; File packageDirectory = packageName == null ? outputDirectory : new File ( outputDirectory , packageName . replace ( ' ' , ' ' ) ) ; if ( ! packageDirectory . exists ( ) ) { packageDirectory . mkdirs ( ) ; } final CucumberITGenerator fileGenerator = createFileGenerator ( ) ; fileGenerator . generateCucumberITFiles ( packageDirectory , sortedFeatureFiles ) ; getLog ( ) . info ( "Adding " + outputDirectory . getAbsolutePath ( ) + " to test-compile source root" ) ; project . addTestCompileSourceRoot ( outputDirectory . getAbsolutePath ( ) ) ; }
Called by Maven to run this mojo after parameters have been injected .