[MPLUGIN-314] invalid requirement role generated in plugin.xml

[MPLUGIN-320] JavaJavadocMojoDescriptorExtractor fails with Java 8 lambdas.

Updating QDox to 2.0-M5, containing the fixes for both of those issues (see QDOX-13 and QDOX-15).

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1778362 13f79535-47bb-0310-9956-ffa450edef68
master
Guillaume Boué 2017-01-12 00:07:08 +00:00
parent f50e9ebb58
commit 49349dee7a
6 changed files with 179 additions and 1 deletions

View File

@ -233,4 +233,20 @@ public class JavaMojoDescriptorExtractorTest
assertEquals( 1, results.size() ); assertEquals( 1, results.size() );
} }
public void testSingleTypeImportWithFullyQualifiedClassName()
throws Exception
{
List<MojoDescriptor> results = extract( "MPLUGIN-314" );
assertEquals( 1, results.size() );
}
public void testMethodReferenceInEnumConstructor()
throws Exception
{
List<MojoDescriptor> results = extract( "MPLUGIN-320" );
assertNull( results );
}
} }

View File

@ -0,0 +1,41 @@
/*
* 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.artifact.resolver.ArtifactResolver;
import org.apache.maven.plugin.AbstractMojo;
/**
* Tests that using an import and the same fully qualified class name results in a correct requirement role generated.
*
* @goal test
*/
public class MyMojo
extends AbstractMojo
{
/**
* @component
*/
private org.apache.maven.artifact.resolver.ArtifactResolver resolver;
public void execute()
{
}
}

View File

@ -0,0 +1,56 @@
<?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.
-->
<plugin>
<name></name>
<description></description>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<goalPrefix>test</goalPrefix>
<isolatedRealm>false</isolatedRealm>
<inheritedByDefault>true</inheritedByDefault>
<mojos>
<mojo>
<goal>test</goal>
<description>Tests that using an import and the same fully qualified class name results in a correct requirement role generated.</description>
<requiresDirectInvocation>false</requiresDirectInvocation>
<requiresProject>true</requiresProject>
<requiresReports>false</requiresReports>
<aggregator>false</aggregator>
<requiresOnline>false</requiresOnline>
<inheritedByDefault>true</inheritedByDefault>
<implementation>MyMojo</implementation>
<language>java</language>
<instantiationStrategy>per-lookup</instantiationStrategy>
<executionStrategy>once-per-session</executionStrategy>
<threadSafe>false</threadSafe>
<parameters/>
<requirements>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
<field-name>resolver</field-name>
</requirement>
</requirements>
</mojo>
</mojos>
<dependencies/>
</plugin>

View File

@ -0,0 +1,32 @@
/*
* 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 java.util.function.Supplier;
public enum Exceptions {
NPE(NullPointerException::new),
IAE(IllegalArgumentException::new);
private final Supplier<? extends Exception> supplier;
<T extends Exception> Exceptions(Supplier<T> supplier) {
this.supplier = supplier;
}
}

View File

@ -0,0 +1,33 @@
<?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.
-->
<plugin>
<name></name>
<description></description>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<goalPrefix>test</goalPrefix>
<isolatedRealm>false</isolatedRealm>
<inheritedByDefault>true</inheritedByDefault>
<mojos/>
<dependencies/>
</plugin>

View File

@ -214,7 +214,7 @@
<dependency> <dependency>
<groupId>com.thoughtworks.qdox</groupId> <groupId>com.thoughtworks.qdox</groupId>
<artifactId>qdox</artifactId> <artifactId>qdox</artifactId>
<version>2.0-M4</version> <version>2.0-M5</version>
</dependency> </dependency>
<dependency> <dependency>