From 9d6fad725a49f36a7fd71e43658dd50cc62e62bb Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Tue, 5 Apr 2005 08:17:28 +0000 Subject: [PATCH] change @requiresDependencyResolution to take a scope (default is "runtime" if no scope specified, none if tag not specified at all). This still means ALL tests get the test dependencies of their compile time dependencies. Check if there is really a valid use case for that. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163780 13f79535-47bb-0310-9956-ffa450edef68 --- .../resolver/DefaultArtifactResolver.java | 2 - .../resolver/filter/ScopeArtifactFilter.java | 85 +++++++++++++++++++ .../maven/plugin/DefaultPluginManager.java | 18 ++-- .../generator/PluginDescriptorGenerator.java | 9 +- .../generator/AbstractGeneratorTestCase.java | 23 ++--- .../PluginDescriptorGeneratorTest.java | 10 ++- .../java/JavaMojoDescriptorExtractor.java | 7 +- .../source/JavaExtractorTestTwo.java | 21 ++--- .../plugin/descriptor/MojoDescriptor.java | 6 +- .../descriptor/PluginDescriptorBuilder.java | 4 +- .../org/apache/maven/plugin/CompilerMojo.java | 30 +++---- .../apache/maven/plugin/TestCompilerMojo.java | 2 +- .../apache/maven/plugin/idea/IdeaMojo.java | 2 +- .../script/marmalade/tags/MetadataTag.java | 12 +-- .../tags/RequiresDependencyResolutionTag.java | 7 +- 15 files changed, 166 insertions(+), 72 deletions(-) create mode 100644 maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 3e9dc905a2..7d5bbb4854 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -280,8 +280,6 @@ public class DefaultArtifactResolver knownVersion, newArtifact.getScope(), knownArtifact.getType() ); - // don't copy file - these aren't resolved yet - resolvedArtifacts.put( artifact.getConflictId(), artifact ); } } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java new file mode 100644 index 0000000000..bdf365a75d --- /dev/null +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java @@ -0,0 +1,85 @@ +package org.apache.maven.artifact.resolver.filter; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DefaultArtifact; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * 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 + * + * 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. + */ + +/** + * Filter to only retain objects in the given scope or better. + * + * @author Brett Porter + * @version $Id$ + */ +public class ScopeArtifactFilter + implements ArtifactFilter +{ + private final boolean compileScope; + + private final boolean runtimeScope; + + private final boolean testScope; + + public ScopeArtifactFilter( String scope ) + { + if ( DefaultArtifact.SCOPE_COMPILE.equals( scope ) ) + { + compileScope = true; + runtimeScope = false; + testScope = false; + } + else if ( DefaultArtifact.SCOPE_RUNTIME.equals( scope ) ) + { + compileScope = true; + runtimeScope = true; + testScope = false; + } + else if ( DefaultArtifact.SCOPE_TEST.equals( scope ) ) + { + compileScope = true; + runtimeScope = true; + testScope = true; + } + else + { + compileScope = false; + runtimeScope = false; + testScope = false; + } + } + + public boolean include( Artifact artifact ) + { + if ( DefaultArtifact.SCOPE_COMPILE.equals( artifact.getScope() ) ) + { + return compileScope; + } + else if ( DefaultArtifact.SCOPE_RUNTIME.equals( artifact.getScope() ) ) + { + return runtimeScope; + } + else if ( DefaultArtifact.SCOPE_TEST.equals( artifact.getScope() ) ) + { + return testScope; + } + else + { + // TODO: should this be true? + return false; + } + } +} diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index 7651b1c523..0550524e80 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -25,6 +25,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; +import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; import org.apache.maven.execution.MavenSession; import org.apache.maven.monitor.event.EventDispatcher; import org.apache.maven.monitor.event.MavenEvents; @@ -340,7 +341,7 @@ public class DefaultPluginManager try { - if ( mojoDescriptor.requiresDependencyResolution() ) + if ( mojoDescriptor.getRequiresDependencyResolution() != null ) { ArtifactResolver artifactResolver = null; @@ -351,7 +352,8 @@ public class DefaultPluginManager artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE ); mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE ); - resolveTransitiveDependencies( session, artifactResolver, mavenProjectBuilder ); + resolveTransitiveDependencies( session, artifactResolver, mavenProjectBuilder, + mojoDescriptor.getRequiresDependencyResolution() ); downloadDependencies( session, artifactResolver ); } finally @@ -700,10 +702,8 @@ public class DefaultPluginManager // TODO: configure this from bootstrap or scan lib artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model", "maven-settings", "maven-monitor", "maven-plugin", - "plexus-container-api", "plexus-container-default", - "plexus-artifact-container", "wagon-provider-api", - "classworlds"} ); - + "plexus-container-default", "plexus-artifact-container", + "wagon-provider-api", "classworlds"} ); } // ---------------------------------------------------------------------- @@ -711,17 +711,19 @@ public class DefaultPluginManager // ---------------------------------------------------------------------- private void resolveTransitiveDependencies( MavenSession context, ArtifactResolver artifactResolver, - MavenProjectBuilder mavenProjectBuilder ) + MavenProjectBuilder mavenProjectBuilder, String scope ) throws ArtifactResolutionException { MavenProject project = context.getProject(); MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver, mavenProjectBuilder ); + ArtifactFilter filter = new ScopeArtifactFilter( scope ); + ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(), context.getRemoteRepositories(), context.getLocalRepository(), - sourceReader ); + sourceReader, filter ); project.addArtifacts( result.getArtifacts().values() ); } diff --git a/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java b/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java index 95d7c0e1d9..d4f52f86e2 100644 --- a/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java +++ b/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java @@ -32,12 +32,13 @@ import java.util.Set; /** * @todo add example usage tag that can be shown in the doco * @todo need to add validation directives so that systems embedding maven2 can - * get validation directives to help users in IDEs. + * get validation directives to help users in IDEs. */ public class PluginDescriptorGenerator implements Generator { - public void execute( String destinationDirectory, Set mavenMojoDescriptors, MavenProject project ) throws Exception + public void execute( String destinationDirectory, Set mavenMojoDescriptors, MavenProject project ) + throws Exception { File f = new File( destinationDirectory, "plugin.xml" ); @@ -94,9 +95,9 @@ public class PluginDescriptorGenerator // // ---------------------------------------------------------------------- - if ( mojoDescriptor.requiresDependencyResolution() ) + if ( mojoDescriptor.getRequiresDependencyResolution() != null ) { - element( w, "requiresDependencyResolution", "true" ); + element( w, "requiresDependencyResolution", mojoDescriptor.getRequiresDependencyResolution() ); } // ---------------------------------------------------------------------- diff --git a/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java b/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java index 3b048da696..144cd0dd39 100644 --- a/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java +++ b/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java @@ -16,6 +16,7 @@ package org.apache.maven.tools.plugin.generator; * limitations under the License. */ +import junit.framework.TestCase; import org.apache.maven.model.Dependency; import org.apache.maven.model.Model; import org.apache.maven.plugin.descriptor.MojoDescriptor; @@ -28,8 +29,6 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import junit.framework.TestCase; - /** * @author Jason van Zyl * @version $Id: AbstractGeneratorTestCase.java,v 1.1 2005/02/20 16:25:21 @@ -42,12 +41,14 @@ public abstract class AbstractGeneratorTestCase protected String basedir; - protected void setUp() throws Exception + protected void setUp() + throws Exception { basedir = System.getProperty( "basedir" ); } - public void testGenerator() throws Exception + public void testGenerator() + throws Exception { setupGenerator(); @@ -61,7 +62,7 @@ public abstract class AbstractGeneratorTestCase mojoDescriptor.setGoal( "testGoal" ); mojoDescriptor.setId( "test" ); mojoDescriptor.setImplementation( "org.apache.maven.tools.plugin.generator.TestMojo" ); - mojoDescriptor.setRequiresDependencyResolution( true ); + mojoDescriptor.setRequiresDependencyResolution( "compile" ); List params = new ArrayList(); @@ -101,7 +102,8 @@ public abstract class AbstractGeneratorTestCase // // ---------------------------------------------------------------------- - protected void setupGenerator() throws Exception + protected void setupGenerator() + throws Exception { String generatorClassName = getClass().getName(); @@ -115,9 +117,9 @@ public abstract class AbstractGeneratorTestCase } catch ( Exception e ) { - throw new Exception( "Cannot find " + generatorClassName - + "! Make sure your test case is named in the form ${generatorClassName}Test " - + "or override the setupPlugin() method to instantiate the mojo yourself." ); + throw new Exception( "Cannot find " + generatorClassName + + "! Make sure your test case is named in the form ${generatorClassName}Test " + + "or override the setupPlugin() method to instantiate the mojo yourself." ); } } @@ -125,7 +127,8 @@ public abstract class AbstractGeneratorTestCase // // ---------------------------------------------------------------------- - protected void validate() throws Exception + protected void validate() + throws Exception { // empty } diff --git a/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java b/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java index cc7cfe6ee1..f6363b6d8d 100644 --- a/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java +++ b/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGeneratorTest.java @@ -39,7 +39,8 @@ import java.util.List; public class PluginDescriptorGeneratorTest extends AbstractGeneratorTestCase { - protected void validate() throws Exception + protected void validate() + throws Exception { PluginDescriptorBuilder pdb = new PluginDescriptorBuilder(); @@ -69,7 +70,8 @@ public class PluginDescriptorGeneratorTest assertEquals( "0.0.0", dependency.getVersion() ); } - private String readFile( File pluginDescriptorFile ) throws IOException + private String readFile( File pluginDescriptorFile ) + throws IOException { StringWriter sWriter = new StringWriter(); PrintWriter pWriter = new PrintWriter( sWriter ); @@ -77,7 +79,7 @@ public class PluginDescriptorGeneratorTest BufferedReader reader = new BufferedReader( new FileReader( pluginDescriptorFile ) ); String line = null; - while ( (line = reader.readLine()) != null ) + while ( ( line = reader.readLine() ) != null ) { pWriter.println( line ); } @@ -96,7 +98,7 @@ public class PluginDescriptorGeneratorTest // The following should be defaults assertEquals( "per-lookup", mojoDescriptor.getInstantiationStrategy() ); - assertTrue( mojoDescriptor.requiresDependencyResolution() ); + assertNotNull( mojoDescriptor.getRequiresDependencyResolution() ); // check the parameter. checkParameter( (Parameter) mojoDescriptor.getParameters().get( 0 ) ); diff --git a/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java b/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java index e4d95e9c00..c7fd6e88f6 100644 --- a/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java +++ b/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java @@ -180,7 +180,12 @@ public class JavaMojoDescriptorExtractor if ( requiresDependencyResolution != null ) { - mojoDescriptor.setRequiresDependencyResolution( true ); + String value = requiresDependencyResolution.getValue(); + if ( value == null || value.length() == 0 ) + { + value = "runtime"; + } + mojoDescriptor.setRequiresDependencyResolution( value ); } // ---------------------------------------------------------------------- diff --git a/maven-plugin-tools/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java b/maven-plugin-tools/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java index f1bd356335..4e4c9adb0c 100644 --- a/maven-plugin-tools/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java +++ b/maven-plugin-tools/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java @@ -1,25 +1,20 @@ -import org.apache.maven.project.MavenProject; + import org.apache.maven.plugin.AbstractPlugin; import org.apache.maven.plugin.PluginExecutionRequest; import org.apache.maven.plugin.PluginExecutionResponse; /** * @goal ideaTwo - * * @description Create an IDEA project file from a Maven project. - * - * @requiresDependencyResolution - * + * @requiresDependencyResolution compile * @prereq foo * @prereq bar - * - * @parameter - * name="project" - * type="String[]" - * required="true" - * validator="org.foo.validator" - * expression="#project" - * description="Maven project used to generate IDEA project files." + * @parameter name="project" + * type="String[]" + * required="true" + * validator="org.foo.validator" + * expression="#project" + * description="Maven project used to generate IDEA project files." */ public class JavaExtractorTestTwo extends AbstractPlugin diff --git a/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java b/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java index 07ee8c898b..5b36943e99 100644 --- a/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java +++ b/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java @@ -54,7 +54,7 @@ public class MojoDescriptor private List prereqs; - private boolean requiresDependencyResolution = false; + private String requiresDependencyResolution = null; private boolean requiresProject = true; @@ -150,12 +150,12 @@ public class MojoDescriptor // Dependency requirement // ---------------------------------------------------------------------- - public void setRequiresDependencyResolution( boolean requiresDependencyResolution ) + public void setRequiresDependencyResolution( String requiresDependencyResolution ) { this.requiresDependencyResolution = requiresDependencyResolution; } - public boolean requiresDependencyResolution() + public String getRequiresDependencyResolution() { return requiresDependencyResolution; } diff --git a/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java b/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java index 97fa0ed946..9e3071157c 100644 --- a/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java +++ b/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java @@ -1,10 +1,10 @@ package org.apache.maven.plugin.descriptor; +import org.apache.maven.plugin.AbstractPlugin; import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.PlexusConfigurationException; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; -import org.apache.maven.plugin.AbstractPlugin; import java.io.Reader; import java.util.ArrayList; @@ -105,7 +105,7 @@ public class PluginDescriptorBuilder if ( dependencyResolution != null ) { - mojo.setRequiresDependencyResolution( dependencyResolution.equals( "true" ) ? true : false ); + mojo.setRequiresDependencyResolution( dependencyResolution ); } // ---------------------------------------------------------------------- diff --git a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java index ae17b4eec0..f7186273a3 100644 --- a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java +++ b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java @@ -34,25 +34,25 @@ import java.util.Set; * @author Jason van Zyl * @version $Id$ * @goal compile - * @requiresDependencyResolution + * @requiresDependencyResolution compile * @description Compiles application sources * @parameter name="compileSourceRoots" type="java.util.List" required="true" validator="" - * expression="#project.compileSourceRoots" description="" + * expression="#project.compileSourceRoots" description="" * @parameter name="outputDirectory" type="String" required="true" validator="" - * expression="#project.build.outputDirectory" description="" + * expression="#project.build.outputDirectory" description="" * @parameter name="classpathElements" type="List" required="true" validator="" - * expression="#project.compileClasspathElements" description="" + * expression="#project.compileClasspathElements" description="" * @parameter name="debug" type="boolean" required="false" validator="" - * expression="#maven.compiler.debug" description="Whether to include debugging - * information in the compiled class files; the default value is false" + * expression="#maven.compiler.debug" description="Whether to include debugging + * information in the compiled class files; the default value is false" * @todo change debug parameter type to Boolean * @parameter name="source" type="String" required="false" expression="#source" validator="" - * description="The -source argument for the Java compiler" + * description="The -source argument for the Java compiler" * @parameter name="target" type="String" required="false" expression="#target" validator="" - * description="The -target argument for the Java compiler" + * description="The -target argument for the Java compiler" * @parameter name="staleMillis" type="long" required="false" expression="#lastModGranularityMs" - * validator="" description="The granularity in milliseconds of the last modification - * date for testing whether a source needs recompilation" + * validator="" description="The granularity in milliseconds of the last modification + * date for testing whether a source needs recompilation" * @todo change staleMillis parameter type to Long */ @@ -167,8 +167,8 @@ public class CompilerMojo } catch ( NumberFormatException e ) { - throw new PluginExecutionException( "Invalid staleMillis plugin parameter value: \'" + staleMillis - + "\'", e ); + throw new PluginExecutionException( "Invalid staleMillis plugin parameter value: \'" + staleMillis + + "\'", e ); } } @@ -194,8 +194,8 @@ public class CompilerMojo } catch ( InclusionScanException e ) { - throw new PluginExecutionException( "Error scanning source root: \'" + sourceRoot - + "\' for stale files to recompile.", e ); + throw new PluginExecutionException( "Error scanning source root: \'" + sourceRoot + + "\' for stale files to recompile.", e ); } } @@ -204,7 +204,7 @@ public class CompilerMojo /** * @todo also in ant plugin. This should be resolved at some point so that it does not need to - * be calculated continuously - or should the plugins accept empty source roots as is? + * be calculated continuously - or should the plugins accept empty source roots as is? */ private static List removeEmptyCompileSourceRoots( List compileSourceRootsList ) { diff --git a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java index 8e1e5c60b2..4eb7256c5d 100644 --- a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java +++ b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/TestCompilerMojo.java @@ -21,7 +21,7 @@ package org.apache.maven.plugin; * @version $Id$ * @goal testCompile * @description Compiles test sources - * @requiresDependencyResolution + * @requiresDependencyResolution test * @parameter name="compileSourceRoots" * type="java.util.List" * required="true" diff --git a/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java b/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java index 5789fa095c..5355fe7a44 100644 --- a/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java +++ b/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java @@ -38,7 +38,7 @@ import java.util.Iterator; /** * @goal idea - * @requiresDependencyResolution + * @requiresDependencyResolution test * @description Goal for generating IDEA files from a POM * @parameter name="project" * type="MavenProject" diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java index 4bba3cb573..810b98580a 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java @@ -27,7 +27,7 @@ import java.util.List; /** * Aggregator tag for the actual meat of the mojo. - * + * * @author jdcasey Created on Feb 8, 2005 */ public class MetadataTag @@ -39,7 +39,7 @@ public class MetadataTag private String goal; - private boolean requiresDependencyResolution = true; + private String requiresDependencyResolution = null; private boolean requiresProject = true; @@ -58,7 +58,8 @@ public class MetadataTag return false; } - protected void doExecute( MarmaladeExecutionContext context ) throws MarmaladeExecutionException + protected void doExecute( MarmaladeExecutionContext context ) + throws MarmaladeExecutionException { processChildren( context ); @@ -66,7 +67,8 @@ public class MetadataTag context.setVariable( MarmaladeMojoExecutionDirectives.METADATA_OUTVAR, descriptor, true ); } - private MojoDescriptor buildDescriptor( MarmaladeExecutionContext context ) throws MarmaladeExecutionException + private MojoDescriptor buildDescriptor( MarmaladeExecutionContext context ) + throws MarmaladeExecutionException { MojoDescriptor descriptor = new MojoDescriptor(); @@ -146,7 +148,7 @@ public class MetadataTag this.description = description; } - public void setRequiresDependencyResolution( boolean requiresDependencyResolution ) + public void setRequiresDependencyResolution( String requiresDependencyResolution ) { this.requiresDependencyResolution = requiresDependencyResolution; } diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresDependencyResolutionTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresDependencyResolutionTag.java index 057a196277..0c16af83af 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresDependencyResolutionTag.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresDependencyResolutionTag.java @@ -22,13 +22,14 @@ import org.codehaus.marmalade.runtime.MarmaladeExecutionException; * @author jdcasey Created on Feb 8, 2005 */ public class RequiresDependencyResolutionTag - extends AbstractBooleanValuedBodyTag + extends AbstractStringValuedBodyTag { - protected void setValue( Boolean value ) throws MarmaladeExecutionException + protected void setValue( String value ) + throws MarmaladeExecutionException { MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class ); - metadataTag.setRequiresDependencyResolution( value.booleanValue() ); + metadataTag.setRequiresDependencyResolution( value ); } } \ No newline at end of file