[MPLUGIN-189] support inheritence from classes available in dependencies: it with annotations in parent class available in reactors
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/branches/MPLUGIN-189@1335763 13f79535-47bb-0310-9956-ffa450edef68master
parent
2373bae319
commit
77a87b0236
|
|
@ -0,0 +1,6 @@
|
||||||
|
invoker.goals.1 = clean install -DskipTests
|
||||||
|
invoker.goals.2 = org.apache.maven.its.annotation-with-inheritance-reactor:module-mojo:1.0-SNAPSHOT:it0014
|
||||||
|
invoker.goals.3 = org.apache.maven.its.annotation-with-inheritance-reactor:module-mojo:1.0-SNAPSHOT:first
|
||||||
|
#FIXME disabled need to find a solution for the chicken and eggs issue.
|
||||||
|
#help sources are generated @generated-sources but need descriptor which need compile phase first for classes scanning
|
||||||
|
#invoker.goals.3 = org.apache.maven.its.basic-java-annotations:maven-it-basic-java-annotations:1.0::help
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.apache.maven.its.annotation-with-inheritance-reactor</groupId>
|
||||||
|
<artifactId>annotation-with-inheritance-reactor</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>module-abstract-mojo</artifactId>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package org.apache.maven.plugins;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
|
import org.apache.maven.plugins.annotations.Execute;
|
||||||
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
|
import org.codehaus.plexus.compiler.manager.CompilerManager;
|
||||||
|
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Touches a test file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class AbstractFirstMojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project directory.
|
||||||
|
*/
|
||||||
|
@Parameter( defaultValue = "${basedir}", readonly = true )
|
||||||
|
protected File basedir;
|
||||||
|
|
||||||
|
@Parameter( expression = "${first.touchFile}", defaultValue = "${project.build.directory}/touch.txt",
|
||||||
|
required = true )
|
||||||
|
protected File touchFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plexus compiler manager.
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
protected CompilerManager compilerManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Component(role = "org.apache.maven.artifact.metadata.ArtifactMetadataSource", roleHint = "maven")
|
||||||
|
protected ArtifactMetadataSource artifactMetadataSource;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.apache.maven.its.annotation-with-inheritance-reactor</groupId>
|
||||||
|
<artifactId>annotation-with-inheritance-reactor</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
<artifactId>module-mojo</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.its.annotation-with-inheritance-reactor</groupId>
|
||||||
|
<artifactId>module-abstract-mojo</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
|
<version>@project.version@</version>
|
||||||
|
<configuration>
|
||||||
|
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>mojo-descriptor</id>
|
||||||
|
<phase>process-classes</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>descriptor</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Touches a test file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Mojo( name = "it0014")
|
||||||
|
public class CoreIt0014Mojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
|
||||||
|
@Parameter(expression ="${project.build.directory}", required = true)
|
||||||
|
private String outputDirectory;
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
throws MojoExecutionException
|
||||||
|
{
|
||||||
|
getLog().info( "outputDirectory = " + outputDirectory );
|
||||||
|
|
||||||
|
File f = new File( outputDirectory );
|
||||||
|
|
||||||
|
if ( !f.exists() )
|
||||||
|
{
|
||||||
|
f.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
File touch = new File( f, "touch.txt" );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
touch.createNewFile();
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "Error writing verification file.", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
|
import org.apache.maven.plugins.annotations.Execute;
|
||||||
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
|
import org.apache.maven.plugins.AbstractFirstMojo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Touches a test file.
|
||||||
|
*
|
||||||
|
* @since 1.2
|
||||||
|
* @deprecated Don't use!
|
||||||
|
*/
|
||||||
|
@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
||||||
|
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
||||||
|
public class FirstMojo
|
||||||
|
extends AbstractFirstMojo
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.1
|
||||||
|
* @deprecated As of 0.2
|
||||||
|
*/
|
||||||
|
@Parameter( alias = "alias" )
|
||||||
|
private String aliasedParam;
|
||||||
|
|
||||||
|
@Component( role = "org.apache.maven.project.MavenProjectHelper", roleHint = "default" )
|
||||||
|
private Object projectHelper;
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
throws MojoExecutionException
|
||||||
|
{
|
||||||
|
if (basedir == null)
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "basedir == null" );
|
||||||
|
}
|
||||||
|
if (touchFile == null)
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "touchFile == null" );
|
||||||
|
}
|
||||||
|
if ( projectHelper == null )
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "projectHelper == null" );
|
||||||
|
}
|
||||||
|
if ( compilerManager == null )
|
||||||
|
{
|
||||||
|
throw new MojoExecutionException( "compilerManager == null" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does nothing special.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Mojo( name = "second",requiresDependencyCollection = "compile", threadSafe = true)
|
||||||
|
public class SecondMojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<lifecycles>
|
||||||
|
<lifecycle>
|
||||||
|
<id>cobertura</id>
|
||||||
|
<phases>
|
||||||
|
<phase>
|
||||||
|
<id>process-classes</id>
|
||||||
|
</phase>
|
||||||
|
<phase>
|
||||||
|
<id>test</id>
|
||||||
|
<configuration>
|
||||||
|
<classesDirectory>${project.build.directory}/generated-classes/cobertura</classesDirectory>
|
||||||
|
<testFailureIgnore>true</testFailureIgnore>
|
||||||
|
</configuration>
|
||||||
|
</phase>
|
||||||
|
</phases>
|
||||||
|
</lifecycle>
|
||||||
|
</lifecycles>
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.apache.maven.its.annotation-with-inheritance-reactor</groupId>
|
||||||
|
<artifactId>annotation-with-inheritance-reactor</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<name>Maven Integration Test :: annotation-with-inheritance</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>module-abstract-mojo</module>
|
||||||
|
<module>module-mojo</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<plexusCompilerVersion>1.8.6</plexusCompilerVersion>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-project</artifactId>
|
||||||
|
<version>@mavenVersion@</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
|
<artifactId>maven-plugin-annotations</artifactId>
|
||||||
|
<version>@project.version@</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-compiler-manager</artifactId>
|
||||||
|
<version>${plexusCompilerVersion}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-component-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-compiler-javac</artifactId>
|
||||||
|
<version>${plexusCompilerVersion}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-component-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
File touchFile = new File( basedir, "module-mojo/target/touch.txt" )
|
||||||
|
assert touchFile.isFile()
|
||||||
|
|
||||||
|
File descriptorFile = new File( basedir, "module-mojo/target/classes/META-INF/maven/plugin.xml" );
|
||||||
|
assert descriptorFile.isFile()
|
||||||
|
|
||||||
|
def pluginDescriptor = new XmlParser().parse( descriptorFile );
|
||||||
|
|
||||||
|
def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first"}[0]
|
||||||
|
|
||||||
|
assert mojo.goal.text() == 'first'
|
||||||
|
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
|
||||||
|
assert mojo.language.text() == 'java'
|
||||||
|
assert mojo.description.text() == 'Touches a test file.'
|
||||||
|
assert mojo.deprecated.text() == "Don't use!"
|
||||||
|
assert mojo.requiresDependencyResolution.text() == 'test'
|
||||||
|
assert mojo.requiresDependencyCollection.text() == ''
|
||||||
|
assert mojo.requiresProject.text() == 'true'
|
||||||
|
assert mojo.requiresOnline.text() == 'false'
|
||||||
|
assert mojo.requiresDirectInvocation.text() == 'false'
|
||||||
|
assert mojo.aggregator.text() == 'false'
|
||||||
|
assert mojo.threadSafe.text() == 'false'
|
||||||
|
assert mojo.phase.text() == 'integration-test'
|
||||||
|
assert mojo.executePhase.text() == 'generate-sources'
|
||||||
|
assert mojo.executeLifecycle.text() == 'cobertura'
|
||||||
|
|
||||||
|
assert mojo.configuration.basedir[0].text() == ''
|
||||||
|
assert mojo.configuration.basedir[0].'@implementation' == 'java.io.File'
|
||||||
|
assert mojo.configuration.basedir[0].'@default-value' == '${basedir}'
|
||||||
|
|
||||||
|
assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
|
||||||
|
assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
|
||||||
|
assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'
|
||||||
|
|
||||||
|
assert mojo.requirements.requirement.size() == 3
|
||||||
|
|
||||||
|
assert mojo.requirements.requirement[1].role.text() == 'org.apache.maven.project.MavenProjectHelper'
|
||||||
|
assert mojo.requirements.requirement[1].'role-hint'.text() == 'default'
|
||||||
|
assert mojo.requirements.requirement[1].'field-name'.text() == 'projectHelper'
|
||||||
|
|
||||||
|
assert mojo.parameters.parameter.size() == 3
|
||||||
|
|
||||||
|
def parameter = mojo.parameters.parameter.findAll{ it.name.text() == "aliasedParam"}[0]
|
||||||
|
|
||||||
|
assert parameter.name.text() == 'aliasedParam'
|
||||||
|
assert parameter.alias.text() == 'alias'
|
||||||
|
assert parameter.type.text() == 'java.lang.String'
|
||||||
|
assert parameter.deprecated.text() == 'As of 0.2'
|
||||||
|
assert parameter.required.text() == 'false'
|
||||||
|
assert parameter.editable.text() == 'true'
|
||||||
|
assert parameter.description.text() == ''
|
||||||
|
|
||||||
|
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile"}[0]
|
||||||
|
|
||||||
|
assert parameter.name.text() == 'touchFile'
|
||||||
|
assert parameter.alias.isEmpty()
|
||||||
|
assert parameter.type.text() == 'java.io.File'
|
||||||
|
assert parameter.deprecated.isEmpty()
|
||||||
|
assert parameter.required.text() == 'true'
|
||||||
|
assert parameter.editable.text() == 'true'
|
||||||
|
assert parameter.description.text() == ''
|
||||||
|
|
||||||
|
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "basedir"}[0]
|
||||||
|
|
||||||
|
assert parameter.name.text() == 'basedir'
|
||||||
|
assert parameter.alias.isEmpty()
|
||||||
|
assert parameter.type.text() == 'java.io.File'
|
||||||
|
assert parameter.deprecated.isEmpty()
|
||||||
|
assert parameter.required.text() == 'false'
|
||||||
|
assert parameter.editable.text() == 'false'
|
||||||
|
assert parameter.description.text() == 'Project directory.'
|
||||||
|
|
||||||
|
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second"}[0]
|
||||||
|
|
||||||
|
assert mojo.requiresDependencyCollection.text() == 'compile'
|
||||||
|
assert mojo.threadSafe.text() == 'true'
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
@ -42,6 +42,7 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -65,8 +66,7 @@ public class DefaultMojoAnnotationsScanner
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
//TODO scan dependencies to get super class annotations if exist request.getDependencies()
|
for ( File dependency : request.getDependencies() )
|
||||||
/*for ( File dependency : request.getDependencies() )
|
|
||||||
{
|
{
|
||||||
if ( dependency.isDirectory() )
|
if ( dependency.isDirectory() )
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +77,7 @@ public class DefaultMojoAnnotationsScanner
|
||||||
mojoAnnotatedClasses.putAll( scanFile( dependency, request.getIncludePatterns() ) );
|
mojoAnnotatedClasses.putAll( scanFile( dependency, request.getIncludePatterns() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}
|
||||||
|
|
||||||
for ( File classDirectory : request.getClassesDirectories() )
|
for ( File classDirectory : request.getClassesDirectories() )
|
||||||
{
|
{
|
||||||
|
|
@ -98,6 +98,10 @@ public class DefaultMojoAnnotationsScanner
|
||||||
protected Map<String, MojoAnnotatedClass> scanFile( File archiveFile, List<String> includePatterns )
|
protected Map<String, MojoAnnotatedClass> scanFile( File archiveFile, List<String> includePatterns )
|
||||||
throws IOException, ExtractionException
|
throws IOException, ExtractionException
|
||||||
{
|
{
|
||||||
|
if ( !archiveFile.exists() )
|
||||||
|
{
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<String, MojoAnnotatedClass>();
|
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<String, MojoAnnotatedClass>();
|
||||||
ZipInputStream archiveStream = new ZipInputStream( new FileInputStream( archiveFile ) );
|
ZipInputStream archiveStream = new ZipInputStream( new FileInputStream( archiveFile ) );
|
||||||
|
|
||||||
|
|
@ -135,6 +139,10 @@ public class DefaultMojoAnnotationsScanner
|
||||||
protected Map<String, MojoAnnotatedClass> scanDirectory( File classDirectory, List<String> includePatterns )
|
protected Map<String, MojoAnnotatedClass> scanDirectory( File classDirectory, List<String> includePatterns )
|
||||||
throws IOException, ExtractionException
|
throws IOException, ExtractionException
|
||||||
{
|
{
|
||||||
|
if ( !classDirectory.exists() )
|
||||||
|
{
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<String, MojoAnnotatedClass>();
|
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<String, MojoAnnotatedClass>();
|
||||||
DirectoryScanner scanner = new DirectoryScanner();
|
DirectoryScanner scanner = new DirectoryScanner();
|
||||||
scanner.setBasedir( classDirectory );
|
scanner.setBasedir( classDirectory );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue