maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r806335 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/plugin/ maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/ maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/ maven-plugin-api/s...
Date Thu, 20 Aug 2009 20:06:59 GMT
Author: bentmann
Date: Thu Aug 20 20:06:58 2009
New Revision: 806335

URL: http://svn.apache.org/viewvc?rev=806335&view=rev
Log:
[MNG-4313] Plugin descriptor builder ignores deprecation message for mojo

Added:
    maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/
  (with props)
    maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java
  (with props)
    maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml   (with props)
Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
    maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java?rev=806335&r1=806334&r2=806335&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
Thu Aug 20 20:06:58 2009
@@ -93,7 +93,7 @@
         MavenSession oldSession = legacySupport.getSession();
 
         try
-        {                        
+        {
             mojo = mavenPluginManager.getConfiguredMojo( Mojo.class, session, mojoExecution
);
 
             Thread.currentThread().setContextClassLoader( pluginRealm );

Modified: maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java?rev=806335&r1=806334&r2=806335&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
(original)
+++ maven/components/trunk/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
Thu Aug 20 20:06:58 2009
@@ -156,6 +156,13 @@
             mojo.setSince( since );
         }
 
+        PlexusConfiguration deprecated = c.getChild( "deprecated", false );
+
+        if ( deprecated != null )
+        {
+            mojo.setDeprecated( deprecated.getValue() );
+        }
+
         String phase = c.getChild( "phase" ).getValue();
 
         if ( phase != null )

Propchange: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/
------------------------------------------------------------------------------
    bugtraq:label = Enter issue ID:

Propchange: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/
------------------------------------------------------------------------------
    bugtraq:message = Issue id: %BUGID%

Propchange: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/
------------------------------------------------------------------------------
    bugtraq:number = false

Propchange: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java?rev=806335&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java
(added)
+++ maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java
Thu Aug 20 20:06:58 2009
@@ -0,0 +1,121 @@
+package org.apache.maven.plugin.descriptor;
+
+/*
+ * 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.IOException;
+import java.io.Reader;
+
+import org.codehaus.plexus.component.repository.ComponentDependency;
+import org.codehaus.plexus.component.repository.ComponentRequirement;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+import org.codehaus.plexus.util.ReaderFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests {@link PluginDescriptorBuilder}.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class PluginDescriptorBuilderTest
+    extends TestCase
+{
+
+    private PluginDescriptor build( String resource )
+        throws IOException, PlexusConfigurationException
+    {
+        Reader reader = ReaderFactory.newXmlReader( getClass().getResourceAsStream( resource
) );
+
+        return new PluginDescriptorBuilder().build( reader );
+    }
+
+    public void testBuildReader()
+        throws Exception
+    {
+        PluginDescriptor pd = build( "/plugin.xml" );
+
+        assertEquals( "org.apache.maven.plugins", pd.getGroupId() );
+        assertEquals( "maven-jar-plugin", pd.getArtifactId() );
+        assertEquals( "2.3-SNAPSHOT", pd.getVersion() );
+        assertEquals( "jar", pd.getGoalPrefix() );
+        assertEquals( "plugin-description", pd.getDescription() );
+        assertEquals( false, pd.isIsolatedRealm() );
+        assertEquals( true, pd.isInheritedByDefault() );
+        assertEquals( 1, pd.getMojos().size() );
+        assertEquals( 1, pd.getDependencies().size() );
+
+        MojoDescriptor md = (MojoDescriptor) pd.getMojos().get( 0 );
+
+        assertEquals( "jar", md.getGoal() );
+        assertEquals( "mojo-description", md.getDescription() );
+        assertEquals( "runtime", md.isDependencyResolutionRequired() );
+        assertEquals( false, md.isAggregator() );
+        assertEquals( false, md.isDirectInvocationOnly() );
+        assertEquals( true, md.isInheritedByDefault() );
+        assertEquals( false, md.isOnlineRequired() );
+        assertEquals( true, md.isProjectRequired() );
+        assertEquals( "package", md.getPhase() );
+        assertEquals( "org.apache.maven.plugin.jar.JarMojo", md.getImplementation() );
+        assertEquals( "antrun", md.getComponentConfigurator() );
+        assertEquals( "java", md.getLanguage() );
+        assertEquals( "per-lookup", md.getInstantiationStrategy() );
+        assertEquals( "some-goal", md.getExecuteGoal() );
+        assertEquals( "generate-sources", md.getExecutePhase() );
+        assertEquals( "cobertura", md.getExecuteLifecycle() );
+        assertEquals( "2.2", md.getSince() );
+        assertEquals( "deprecated-mojo", md.getDeprecated() );
+        assertEquals( 1, md.getRequirements().size() );
+        assertEquals( 1, md.getParameters().size() );
+
+        assertNotNull( md.getMojoConfiguration() );
+        assertEquals( 1, md.getMojoConfiguration().getChildCount() );
+
+        PlexusConfiguration pc = md.getMojoConfiguration().getChild( 0 );
+
+        assertEquals( "${jar.finalName}", pc.getValue() );
+        assertEquals( "${project.build.finalName}", pc.getAttribute( "default-value" ) );
+        assertEquals( "java.lang.String", pc.getAttribute( "implementation" ) );
+
+        Parameter mp = md.getParameters().get( 0 );
+
+        assertEquals( "finalName", mp.getName() );
+        assertEquals( "jarName", mp.getAlias() );
+        assertEquals( "java.lang.String", mp.getType() );
+        assertEquals( true, mp.isEditable() );
+        assertEquals( false, mp.isRequired() );
+        assertEquals( "parameter-description", mp.getDescription() );
+        assertEquals( "deprecated-parameter", mp.getDeprecated() );
+
+        ComponentRequirement cr = (ComponentRequirement) md.getRequirements().get( 0 );
+
+        assertEquals( "org.codehaus.plexus.archiver.Archiver", cr.getRole() );
+        assertEquals( "jar", cr.getRoleHint() );
+        assertEquals( "jarArchiver", cr.getFieldName() );
+
+        ComponentDependency cd = pd.getDependencies().get( 0 );
+
+        assertEquals( "org.apache.maven", cd.getGroupId() );
+        assertEquals( "maven-plugin-api", cd.getArtifactId() );
+        assertEquals( "2.0.6", cd.getVersion() );
+        assertEquals( "jar", cd.getType() );
+    }
+
+}

Propchange: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-plugin-api/src/test/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilderTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml?rev=806335&view=auto
==============================================================================
--- maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml (added)
+++ maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml Thu Aug 20 20:06:58
2009
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin>
+  <description>plugin-description</description>
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-jar-plugin</artifactId>
+  <version>2.3-SNAPSHOT</version>
+  <goalPrefix>jar</goalPrefix>
+  <isolatedRealm>false</isolatedRealm>
+  <inheritedByDefault>true</inheritedByDefault>
+  <mojos>
+    <mojo>
+      <goal>jar</goal>
+      <description>mojo-description</description>
+      <requiresDependencyResolution>runtime</requiresDependencyResolution>
+      <requiresDirectInvocation>false</requiresDirectInvocation>
+      <requiresProject>true</requiresProject>
+      <requiresReports>false</requiresReports>
+      <aggregator>false</aggregator>
+      <requiresOnline>false</requiresOnline>
+      <inheritedByDefault>true</inheritedByDefault>
+      <phase>package</phase>
+      <implementation>org.apache.maven.plugin.jar.JarMojo</implementation>
+      <language>java</language>
+      <instantiationStrategy>per-lookup</instantiationStrategy>
+      <executionStrategy>once-per-session</executionStrategy>
+      <deprecated>deprecated-mojo</deprecated>
+      <since>2.2</since>
+      <executePhase>generate-sources</executePhase>
+      <executeGoal>some-goal</executeGoal>
+      <executeLifecycle>cobertura</executeLifecycle>
+      <configurator>antrun</configurator>
+      <parameters>
+        <parameter>
+          <name>finalName</name>
+          <alias>jarName</alias>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+          <description>parameter-description</description>
+          <deprecated>deprecated-parameter</deprecated>
+        </parameter>
+      </parameters>
+      <configuration>
+        <finalName implementation="java.lang.String" default-value="${project.build.finalName}">${jar.finalName}</finalName>
+      </configuration>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.archiver.Archiver</role>
+          <role-hint>jar</role-hint>
+          <field-name>jarArchiver</field-name>
+        </requirement>
+      </requirements>
+    </mojo>
+  </mojos>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <type>jar</type>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+</plugin>

Propchange: maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-plugin-api/src/test/resources/plugin.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message