[MPLUGIN-206] Annotations in superclasses are not found if an intermediate class is not annotated.
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1343159 13f79535-47bb-0310-9956-ffa450edef68master
parent
3381348ff3
commit
e37c9d413c
|
|
@ -2,3 +2,4 @@ invoker.goals.1 = clean install -DskipTests
|
|||
invoker.goals.2 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0-SNAPSHOT:it0014
|
||||
invoker.goals.3 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0-SNAPSHOT:first
|
||||
invoker.goals.4 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0-SNAPSHOT:help
|
||||
invoker.goals.5 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0-SNAPSHOT:third
|
||||
|
|
@ -32,7 +32,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
|||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Touches a test file.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFirstMojo
|
||||
|
|
|
|||
|
|
@ -144,6 +144,12 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( !isMojoAnnnotatedClassCandidate( mojoAnnotatedClass ) )
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
MavenProject mavenProject =
|
||||
getFromProjectReferences( mojoAnnotatedClass.getArtifact(), request.getProject() );
|
||||
|
||||
|
|
@ -184,6 +190,17 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
|||
return javaClassesMap;
|
||||
}
|
||||
|
||||
private boolean isMojoAnnnotatedClassCandidate( MojoAnnotatedClass mojoAnnotatedClass )
|
||||
{
|
||||
if ( mojoAnnotatedClass == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ( !mojoAnnotatedClass.getComponents().isEmpty() || !mojoAnnotatedClass.getParameters().isEmpty()
|
||||
|| mojoAnnotatedClass.getExecute() != null || mojoAnnotatedClass.getMojo() != null );
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, JavaClass> discoverClassesFromSourcesJar( Artifact artifact, PluginToolsRequest request,
|
||||
String classifier )
|
||||
throws ExtractionException
|
||||
|
|
@ -205,9 +222,8 @@ public class JavaAnnotationsMojoDescriptorExtractor
|
|||
// extract sources to target/maven-plugin-plugin-sources/${groupId}/${artifact}/sources
|
||||
File extractDirectory = new File( request.getProject().getBuild().getDirectory(),
|
||||
"maven-plugin-plugin-sources/" + sourcesArtifact.getGroupId() + "/"
|
||||
+ sourcesArtifact.getArtifactId() + "/"
|
||||
+ sourcesArtifact.getVersion() + "/"
|
||||
+ sourcesArtifact.getClassifier() );
|
||||
+ sourcesArtifact.getArtifactId() + "/" + sourcesArtifact.getVersion()
|
||||
+ "/" + sourcesArtifact.getClassifier() );
|
||||
extractDirectory.mkdirs();
|
||||
|
||||
UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class DefaultMojoAnnotationsScanner
|
|||
{
|
||||
mojoClassVisitor.getMojoAnnotatedClass().setMojo( null );
|
||||
}
|
||||
if ( isMojoAnnnotatedClassCandidate( mojoClassVisitor.getMojoAnnotatedClass() ) != null )
|
||||
if ( isStoreClass( mojoClassVisitor.getMojoAnnotatedClass() ) != null )
|
||||
{
|
||||
getLogger().debug(
|
||||
"found MojoAnnotatedClass:" + mojoClassVisitor.getMojoAnnotatedClass().getClassName() + ":"
|
||||
|
|
@ -207,7 +207,7 @@ public class DefaultMojoAnnotationsScanner
|
|||
{
|
||||
mojoClassVisitor.getMojoAnnotatedClass().setMojo( null );
|
||||
}
|
||||
if ( isMojoAnnnotatedClassCandidate( mojoClassVisitor.getMojoAnnotatedClass() ) != null )
|
||||
if ( isStoreClass( mojoClassVisitor.getMojoAnnotatedClass() ) != null )
|
||||
{
|
||||
getLogger().debug(
|
||||
"found MojoAnnotatedClass:" + mojoClassVisitor.getMojoAnnotatedClass().getClassName() + ":"
|
||||
|
|
@ -228,20 +228,24 @@ public class DefaultMojoAnnotationsScanner
|
|||
return mojoAnnotatedClasses;
|
||||
}
|
||||
|
||||
private MojoAnnotatedClass isMojoAnnnotatedClassCandidate( MojoAnnotatedClass mojoAnnotatedClass )
|
||||
private MojoAnnotatedClass isStoreClass( MojoAnnotatedClass mojoAnnotatedClass )
|
||||
{
|
||||
if ( mojoAnnotatedClass == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return mojoAnnotatedClass;
|
||||
/**
|
||||
if ( !mojoAnnotatedClass.getComponents().isEmpty() || !mojoAnnotatedClass.getParameters().isEmpty()
|
||||
|| mojoAnnotatedClass.getExecute() != null || mojoAnnotatedClass.getMojo() != null )
|
||||
{
|
||||
return mojoAnnotatedClass;
|
||||
}
|
||||
return null;
|
||||
**/
|
||||
}
|
||||
|
||||
|
||||
protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor )
|
||||
throws ExtractionException
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue