Modified: maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java?view=diff&rev=489838&r1=489837&r2=489838 ============================================================================== --- maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java (original) +++ maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParseException.java Fri Dec 22 18:42:28 2006 @@ -1,20 +1,40 @@ package org.apache.maven.plugin.tools.model; +/* + * 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.io.File; public class PluginMetadataParseException extends Exception { - + static final long serialVersionUID = 1; private final File metadataFile; + private final String originalMessage; public PluginMetadataParseException( File metadataFile, String message, Throwable cause ) { super( "Error parsing file: " + metadataFile + ". Reason: " + message, cause ); - + this.metadataFile = metadataFile; this.originalMessage = message; } @@ -22,16 +42,16 @@ public PluginMetadataParseException( File metadataFile, String message ) { super( "Error parsing file: " + metadataFile + ". Reason: " + message ); - + this.metadataFile = metadataFile; this.originalMessage = message; } - + public File getMetadataFile() { return metadataFile; } - + public String getOriginalMessage() { return originalMessage;
Modified: maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java?view=diff&rev=489838&r1=489837&r2=489838 ============================================================================== --- maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java (original) +++ maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java Fri Dec 22 18:42:28 2006 @@ -1,5 +1,24 @@ package org.apache.maven.plugin.tools.model; +/* + * 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.descriptor.DuplicateParameterException; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.Parameter; @@ -21,32 +40,32 @@ public class PluginMetadataParser { public static final String IMPL_BASE_PLACEHOLDER = "<REPLACE-WITH-MOJO-PATH>"; - + public Set parseMojoDescriptors( File metadataFile ) throws PluginMetadataParseException { Set descriptors = new HashSet(); - + Reader reader = null; - + try { reader = new FileReader( metadataFile ); - + PluginMetadataXpp3Reader metadataReader = new PluginMetadataXpp3Reader(); - + PluginMetadata pluginMetadata = metadataReader.read( reader ); - + List mojos = pluginMetadata.getMojos(); - + if ( mojos != null && !mojos.isEmpty() ) { for ( Iterator it = mojos.iterator(); it.hasNext(); ) { Mojo mojo = (Mojo) it.next(); - + MojoDescriptor descriptor = asDescriptor( metadataFile, mojo ); - + descriptors.add( descriptor ); } } @@ -63,7 +82,7 @@ { IOUtil.close( reader ); } - + return descriptors; } @@ -71,9 +90,9 @@ throws PluginMetadataParseException { MojoDescriptor descriptor = new MojoDescriptor(); - + descriptor.setImplementation( IMPL_BASE_PLACEHOLDER + ":" + mojo.getCall() ); - + descriptor.setGoal( mojo.getGoal() ); descriptor.setPhase( mojo.getPhase() ); descriptor.setDependencyResolutionRequired( mojo.getRequiresDependencyResolution() ); @@ -85,22 +104,23 @@ descriptor.setRequiresReports( mojo.isRequiresReports() ); descriptor.setDescription( mojo.getDescription() ); descriptor.setDeprecated( mojo.getDeprecation() ); - + LifecycleExecution le = mojo.getExecution(); if ( le != null ) { descriptor.setExecuteLifecycle( le.getLifecycle() ); descriptor.setExecutePhase( le.getPhase() ); } - + List parameters = mojo.getParameters(); - + if ( parameters != null && !parameters.isEmpty() ) { for ( Iterator it = parameters.iterator(); it.hasNext(); ) { - org.apache.maven.plugin.tools.model.Parameter param = (org.apache.maven.plugin.tools.model.Parameter) it.next(); - + org.apache.maven.plugin.tools.model.Parameter param = + (org.apache.maven.plugin.tools.model.Parameter) it.next(); + Parameter dParam = new Parameter(); dParam.setAlias( param.getAlias() ); dParam.setDeprecated( param.getDeprecation() ); @@ -108,7 +128,7 @@ dParam.setEditable( !param.isReadonly() ); dParam.setExpression( param.getExpression() ); dParam.setDefaultValue( param.getDefaultValue() ); - + String property = param.getProperty(); if ( StringUtils.isNotEmpty( property ) ) { @@ -118,42 +138,45 @@ { dParam.setName( param.getName() ); } - + if ( StringUtils.isEmpty( dParam.getName() ) ) { - throw new PluginMetadataParseException( metadataFile, "Mojo: \'" + mojo.getGoal() + "\' has a parameter without either property or name attributes. Please specify one." ); + throw new PluginMetadataParseException( metadataFile, "Mojo: \'" + mojo.getGoal() + + "\' has a parameter without either property or name attributes. Please specify one." ); } dParam.setRequired( param.isRequired() ); dParam.setType( param.getType() ); - + try { descriptor.addParameter( dParam ); } catch ( DuplicateParameterException e ) { - throw new PluginMetadataParseException( metadataFile, "Duplicate parameters detected for mojo: " + mojo.getGoal(), e ); + throw new PluginMetadataParseException( metadataFile, + "Duplicate parameters detected for mojo: " + mojo.getGoal(), + e ); } } } - + List components = mojo.getComponents(); - + if ( components != null && !components.isEmpty() ) { for ( Iterator it = components.iterator(); it.hasNext(); ) { Component component = (Component) it.next(); - + ComponentRequirement cr = new ComponentRequirement(); cr.setRole( component.getRole() ); cr.setRoleHint( component.getHint() ); - + descriptor.addRequirement( cr ); } } - + return descriptor; } Modified: maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo?view=diff&rev=489838&r1=489837&r2=489838 ============================================================================== --- maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo (original) +++ maven/shared/trunk/maven-plugin-tools/maven-plugin-tools-model/src/main/mdo/plugin-metadata.mdo Fri Dec 22 18:42:28 2006 @@ -1,52 +1,71 @@ <!-- -<pluginMetadata> - <mojos> - <mojo> - <goal>myGoal</goal> - <phase>compile</phase> - <requiresDependencyResolution>compile</requiresDependencyResolution> - <requiresProject>true</requiresProject> - <requiresReports>true</requiresReports> - <requiresOnline>true</requiresOnline> - <inheritByDefault>true</inheritByDefault> - <requiresDirectInvocation>true</requiresDirectInvocation> - <aggregator>true</aggregator> - - <execute> - <phase>initialize</phase> - <lifecycle>mine</lifecycle> - <goal>goal</goal> - </execute> + ~ 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. + --> - <components> - <component> - <role>stuff</role> - <hint>more</hint> - </component> - </components> + <!-- + <pluginMetadata> + <mojos> + <mojo> + <goal>myGoal</goal> + <phase>compile</phase> + <requiresDependencyResolution>compile</requiresDependencyResolution> + <requiresProject>true</requiresProject> + <requiresReports>true</requiresReports> + <requiresOnline>true</requiresOnline> + <inheritByDefault>true</inheritByDefault> + <requiresDirectInvocation>true</requiresDirectInvocation> + <aggregator>true</aggregator> - <parameters> - <parameter> - <name>nom</name> - <property>prop</property> - <required>true</required> - <readonly>true</readonly> - <expression>${my.property}</expression> - <defaultValue>${project.artifactId}</defaultValue> - <type>org.apache.maven.project.MavenProject</type> - <alias>otherProp</alias> - <description>Test parameter</description> - <deprecated>Use something else</deprecated> - </parameter> - </parameters> - <description> - This is a test. - </description> - <deprecated>Use another mojo</deprecated> - </mojo> - </mojos> -</pluginMetadata> - --> + <execute> + <phase>initialize</phase> + <lifecycle>mine</lifecycle> + <goal>goal</goal> + </execute> + + <components> + <component> + <role>stuff</role> + <hint>more</hint> + </component> + </components> + + <parameters> + <parameter> + <name>nom</name> + <property>prop</property> + <required>true</required> + <readonly>true</readonly> + <expression>${my.property}</expression> + <defaultValue>${project.artifactId}</defaultValue> + <type>org.apache.maven.project.MavenProject</type> + <alias>otherProp</alias> + <description>Test parameter</description> + <deprecated>Use something else</deprecated> + </parameter> + </parameters> + <description> + This is a test. + </description> + <deprecated>Use another mojo</deprecated> + </mojo> + </mojos> + </pluginMetadata> + --> <model> <id>plugin-metadata</id> <name>PluginMetadata</name> @@ -99,7 +118,8 @@ <version>1.0.0</version> <name>aggregator</name> <type>boolean</type> - <description>Whether this mojo operates as an aggregator when the reactor is run. That is, only runs once.</description> + <description>Whether this mojo operates as an aggregator when the reactor is run. That is, only runs once. + </description> </field> <field> <version>1.0.0</version> @@ -129,13 +149,15 @@ <version>1.0.0</version> <name>inheritByDefault</name> <type>boolean</type> - <description>Whether this mojo's configuration should propagate down the POM inheritance chain by default.</description> + <description>Whether this mojo's configuration should propagate down the POM inheritance chain by default. + </description> </field> <field> <version>1.0.0</version> <name>requiresDirectInvocation</name> <type>boolean</type> - <description>If true, this mojo can only be directly invoked (eg. specified directly on the command line).</description> + <description>If true, this mojo can only be directly invoked (eg. specified directly on the command line). + </description> </field> <field> <version>1.0.0</version> @@ -194,7 +216,9 @@ <name>lifecycle</name> <version>1.0.0</version> <type>String</type> - <description>The name of the overlay to apply to the sub-lifecycle before executing it. If specified, this lifecycle overlay definition will be bundled with the plugin.</description> + <description>The name of the overlay to apply to the sub-lifecycle before executing it. If specified, this + lifecycle overlay definition will be bundled with the plugin. + </description> </field> <field> <name>phase</name> @@ -205,7 +229,8 @@ <field> <name>goal</name> <version>1.0.0</version> - <description>A goal, not attached to a lifecycle phase, which should be executed ahead of this mojo.</description> + <description>A goal, not attached to a lifecycle phase, which should be executed ahead of this mojo. + </description> <type>String</type> </field> </fields> Modified: maven/shared/trunk/maven-plugin-tools/pom.xml URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-plugin-tools/pom.xml?view=diff&rev=489838&r1=489837&r2=489838 ============================================================================== --- maven/shared/trunk/maven-plugin-tools/pom.xml (original) +++ maven/shared/trunk/maven-plugin-tools/pom.xml Fri Dec 22 18:42:28 2006 @@ -1,19 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - ~ Copyright 2005-2006 The Apache Software Foundation. + ~ 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 ~ - ~ Licensed 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 ~ - ~ 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. + ~ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"