project.setFile( new File( pom ) );
project.addCompileSourceRoot( sourceDirectory );
// Lookup the mojo scanner instance, and use it to scan for mojo's, and
// extract their descriptors.
MojoScanner scanner = new DefaultMojoScanner(
Collections.singletonMap( "java", new JavaMojoDescriptorExtractor() ) );
PluginDescriptor pluginDescriptor = new PluginDescriptor();
pluginDescriptor.setGroupId( project.getGroupId() );
pluginDescriptor.setArtifactId( project.getArtifactId() );
pluginDescriptor.setVersion( project.getVersion() );
// TODO: should read this from the pom...
pluginDescriptor.setGoalPrefix( PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() ) );
pluginDescriptor.setDependencies( PluginUtils.toComponentDependencies( project.getDependencies() ) );
scanner.populatePluginDescriptor( project, pluginDescriptor );
// Create the generator.
Generator generator = null;
if ( mode.equals( "descriptor" ) )