[MPLUGIN-189] support components field inheritance without role defined

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/branches/MPLUGIN-189@1335092 13f79535-47bb-0310-9956-ffa450edef68
master
Olivier Lamy 2012-05-07 16:15:35 +00:00
parent e008c8012c
commit 2373bae319
2 changed files with 6 additions and 2 deletions

View File

@ -52,7 +52,7 @@ public abstract class AbstractFirstMojo
/**
* Plexus compiler manager.
*/
@Component(role = "org.codehaus.plexus.compiler.manager.CompilerManager")
@Component
protected CompilerManager compilerManager;
/**

View File

@ -33,6 +33,7 @@ import org.apache.maven.tools.plugin.extractor.ExtractionException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.reflection.Reflector;
import org.objectweb.asm.ClassReader;
@ -256,7 +257,10 @@ public class DefaultMojoAnnotationsScanner
reflector.invoke( componentAnnotationContent, entry.getKey(),
new Object[]{ entry.getValue() } );
}
if ( StringUtils.isEmpty( componentAnnotationContent.role() ) )
{
componentAnnotationContent.role( mojoFieldVisitor.getClassName() );
}
}
mojoClassVisitor.getMojoAnnotatedClass().getComponents().put( componentAnnotationContent.getFieldName(),
componentAnnotationContent );