protected PluginDescriptor generate( String directory )
throws Exception
{
JavaMojoDescriptorExtractor extractor = new JavaMojoDescriptorExtractor();
extractor.enableLogging( new ConsoleLogger( Logger.LEVEL_INFO, "test" ) );
PluginToolsRequest request = createRequest( directory );
List<MojoDescriptor> mojoDescriptors = extractor.execute( request );
// to ensure order against plugin-expected.xml
PluginUtils.sortMojos( mojoDescriptors );
for ( MojoDescriptor mojoDescriptor : mojoDescriptors )
{
// to ensure order against plugin-expected.xml
PluginUtils.sortMojoParameters( mojoDescriptor.getParameters() );
request.getPluginDescriptor().addMojo( mojoDescriptor );
}
Generator descriptorGenerator = new PluginDescriptorGenerator( new SystemStreamLog() );
descriptorGenerator.execute( new File( root, directory ), request );
return request.getPluginDescriptor();
}