diff --git a/maven-plugin-plugin/src/it/mplugin-299_no-configuration/invoker.properties b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/invoker.properties new file mode 100644 index 0000000..a9041f9 --- /dev/null +++ b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/invoker.properties @@ -0,0 +1,20 @@ +# 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. + +invoker.maven.version = 3.0+ +invoker.goals.1 = clean install -DskipTests +invoker.goals.2 = --log-file help.log org.apache.maven.its.plugin:help:1.0-SNAPSHOT:help diff --git a/maven-plugin-plugin/src/it/mplugin-299_no-configuration/pom.xml b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/pom.xml new file mode 100644 index 0000000..cafacd4 --- /dev/null +++ b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/pom.xml @@ -0,0 +1,87 @@ + + + + + + 4.0.0 + + org.apache.maven.its.plugin + help + 1.0-SNAPSHOT + maven-plugin + + + Tests generation and compilation of the help mojo. + + + + UTF-8 + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.codehaus.plexus + plexus-utils + 3.0.1 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + @project.version@ + provided + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.4 + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + + default-descriptor + process-classes + + + help-goal + + helpmojo + + + + + + + diff --git a/maven-plugin-plugin/src/it/mplugin-299_no-configuration/src/main/java/test/MyMojo.java b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/src/main/java/test/MyMojo.java new file mode 100644 index 0000000..2a5e518 --- /dev/null +++ b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/src/main/java/test/MyMojo.java @@ -0,0 +1,37 @@ +package test; + +/* + * 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; +import org.apache.maven.plugins.annotations.Parameter; + +@Mojo( name= "test" ) +public class MyMojo + extends AbstractMojo +{ + @Parameter + private String empyAnnotatedParameter; + + public void execute() + { + } + +} diff --git a/maven-plugin-plugin/src/it/mplugin-299_no-configuration/test.properties b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/test.properties new file mode 100644 index 0000000..8b28eaa --- /dev/null +++ b/maven-plugin-plugin/src/it/mplugin-299_no-configuration/test.properties @@ -0,0 +1,19 @@ +# 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. + +detail = true +goal = test diff --git a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm index cc05145..5393e53 100644 --- a/maven-plugin-tools-generators/src/main/resources/help-class-source.vm +++ b/maven-plugin-tools-generators/src/main/resources/help-class-source.vm @@ -321,7 +321,11 @@ public class HelpMojo String parameterName = getValue( parameter, "name" ); String parameterDescription = getValue( parameter, "description" ); - Element fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName ); + Element fieldConfigurationElement = null; + if ( configurationElement != null ) + { + fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName ); + } String parameterDefaultValue = ""; if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) )