You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/07/22 07:07:49 UTC
svn commit: r220239 - in /maven/components/trunk:
maven-core/src/main/java/org/apache/maven/
maven-core/src/main/java/org/apache/maven/execution/
maven-core/src/main/java/org/apache/maven/plugin/
maven-core/src/main/java/org/apache/maven/plugin/version...
Author: brett
Date: Thu Jul 21 22:07:47 2005
New Revision: 220239
URL: http://svn.apache.org/viewcvs?rev=220239&view=rev
Log:
PR: MNG-625
allow a plugin to specify the minimum Maven version (will apply for both building and its execution - this should be separated later).
If you are running an older version then it will not prompt to update when found, and will fail if it is encountered with a hardcoded version.
Added:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java (with props)
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java (with props)
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java
maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=220239&r1=220238&r2=220239&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Thu Jul 21 22:07:47 2005
@@ -19,11 +19,11 @@
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.model.Profile;
@@ -53,19 +53,16 @@
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
-import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.dag.CycleDetectedException;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@@ -90,7 +87,13 @@
protected MavenProfilesBuilder profilesBuilder;
- private ArtifactVersion mavenVersion;
+ protected RuntimeInformation runtimeInformation;
+
+ private static final long MB = 1024 * 1024;
+
+ private static final int MS_PER_SEC = 1000;
+
+ private static final int SEC_PER_MIN = 60;
// ----------------------------------------------------------------------
// Project execution
@@ -99,15 +102,6 @@
public MavenExecutionResponse execute( MavenExecutionRequest request )
throws ReactorException
{
- try
- {
- mavenVersion = getMavenVersion();
- }
- catch ( IOException e )
- {
- throw new ReactorException( "Unable to determine the executing version of Maven", e );
- }
-
if ( request.getSettings().isOffline() )
{
getLogger().info( "Maven is running in offline mode." );
@@ -222,25 +216,6 @@
}
}
- private DefaultArtifactVersion getMavenVersion()
- throws IOException
- {
- InputStream resourceAsStream = null;
- try
- {
- Properties properties = new Properties();
- resourceAsStream = getClass().getClassLoader().getResourceAsStream(
- "META-INF/maven/org.apache.maven/maven-core/pom.properties" );
- properties.load( resourceAsStream );
-
- return new DefaultArtifactVersion( properties.getProperty( "version" ) );
- }
- finally
- {
- IOUtil.close( resourceAsStream );
- }
- }
-
private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive, Settings settings )
throws ProjectBuildingException, ReactorException, IOException, ArtifactResolutionException
{
@@ -255,7 +230,7 @@
if ( project.getPrerequesites() != null && project.getPrerequesites().getMaven() != null )
{
DefaultArtifactVersion version = new DefaultArtifactVersion( project.getPrerequesites().getMaven() );
- if ( mavenVersion.compareTo( version ) < 0 )
+ if ( runtimeInformation.getApplicationVersion().compareTo( version ) < 0 )
{
throw new ProjectBuildingException( "Unable to build project '" + project.getFile() +
"; it requires Maven version " + version.toString() );
@@ -301,7 +276,7 @@
dispatcher.dispatchStart( event, project.getId() );
- MavenExecutionResponse response = null;
+ MavenExecutionResponse response;
try
{
// Actual meat of the code.
@@ -613,14 +588,13 @@
getLogger().info( "Finished at: " + finish );
- final long mb = 1024 * 1024;
-
+ //noinspection CallToSystemGC
System.gc();
Runtime r = Runtime.getRuntime();
getLogger().info(
- "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/" + ( r.totalMemory() / mb ) + "M" );
+ "Final Memory: " + ( r.totalMemory() - r.freeMemory() ) / MB + "M/" + r.totalMemory() / MB + "M" );
}
protected void line()
@@ -630,11 +604,11 @@
protected static String formatTime( long ms )
{
- long secs = ms / 1000;
+ long secs = ms / MS_PER_SEC;
- long min = secs / 60;
+ long min = secs / SEC_PER_MIN;
- secs = secs % 60;
+ secs = secs % SEC_PER_MIN;
String msg = "";
Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java?rev=220239&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java Thu Jul 21 22:07:47 2005
@@ -0,0 +1,60 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.codehaus.plexus.util.IOUtil;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Describes runtime information about the application.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public class DefaultRuntimeInformation
+ implements RuntimeInformation
+{
+ private ArtifactVersion applicationVersion;
+
+ public ArtifactVersion getApplicationVersion()
+ throws IOException
+ {
+ if ( applicationVersion == null )
+ {
+ InputStream resourceAsStream = null;
+ try
+ {
+ Properties properties = new Properties();
+ resourceAsStream = getClass().getClassLoader().getResourceAsStream(
+ "META-INF/maven/org.apache.maven/maven-core/pom.properties" );
+ properties.load( resourceAsStream );
+
+ applicationVersion = new DefaultArtifactVersion( properties.getProperty( "version" ) );
+ }
+ finally
+ {
+ IOUtil.close( resourceAsStream );
+ }
+ }
+ return applicationVersion;
+ }
+}
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java?rev=220239&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java Thu Jul 21 22:07:47 2005
@@ -0,0 +1,33 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+
+import java.io.IOException;
+
+/**
+ * Describes runtime information about the application.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public interface RuntimeInformation
+{
+ ArtifactVersion getApplicationVersion()
+ throws IOException;
+}
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/RuntimeInformation.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=220239&r1=220238&r2=220239&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Thu Jul 21 22:07:47 2005
@@ -19,8 +19,8 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
@@ -29,9 +29,11 @@
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.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.ReportSet;
@@ -49,6 +51,8 @@
import org.apache.maven.plugin.version.PluginVersionManager;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.settings.Settings;
@@ -73,6 +77,7 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
@@ -110,6 +115,10 @@
protected ArtifactMetadataSource metadataSource;
protected MavenPluginMappingBuilder pluginMappingBuilder;
+
+ protected RuntimeInformation runtimeInformation;
+
+ protected MavenProjectBuilder mavenProjectBuilder;
// END component requirements
public DefaultPluginManager()
@@ -141,9 +150,9 @@
try
{
- mappingManager = pluginMappingBuilder.refreshPluginMappingManager( session
- .getPluginMappingManager(), project.getPluginArtifactRepositories(), session
- .getLocalRepository() );
+ mappingManager = pluginMappingBuilder.refreshPluginMappingManager( session.getPluginMappingManager(),
+ project.getPluginArtifactRepositories(),
+ session.getLocalRepository() );
}
catch ( RepositoryMetadataManagementException e )
{
@@ -165,14 +174,12 @@
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException
{
// TODO: this should be possibly outside
- // [HTTP-301] All version-resolution logic has been moved to DefaultPluginVersionManager. :)
+ // All version-resolution logic has been moved to DefaultPluginVersionManager.
if ( plugin.getVersion() == null )
{
- String groupId = plugin.getGroupId();
- String artifactId = plugin.getArtifactId();
-
- plugin.setVersion(
- pluginVersionManager.resolvePluginVersion( groupId, artifactId, project, settings, localRepository ) );
+ String version = pluginVersionManager.resolvePluginVersion( plugin.getGroupId(), plugin.getArtifactId(),
+ project, settings, localRepository );
+ plugin.setVersion( version );
}
// TODO: this might result in an artifact "RELEASE" being resolved continuously
@@ -181,13 +188,11 @@
try
{
VersionRange versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );
- Artifact pluginArtifact = artifactFactory.createPluginArtifact( plugin.getGroupId(),
- plugin.getArtifactId(), versionRange );
- // I think this ensures the plugin is not resolved multiple times
- // TODO: put it back
-// plugin.setVersion( pluginArtifact.getBaseVersion() );
+ checkRequiredMavenVersion( plugin, localRepository, project.getPluginArtifactRepositories() );
+ Artifact pluginArtifact = artifactFactory.createPluginArtifact( plugin.getGroupId(),
+ plugin.getArtifactId(), versionRange );
addPlugin( plugin, pluginArtifact, project, localRepository );
project.addPlugin( plugin );
@@ -225,6 +230,42 @@
}
return pluginCollector.getPluginDescriptor( plugin );
+ }
+
+ /**
+ * @todo would be better to store this in the plugin descriptor, but then it won't be available to the version
+ * manager which executes before the plugin is instantiated
+ */
+ private void checkRequiredMavenVersion( Plugin plugin, ArtifactRepository localRepository, List remoteRepositories )
+ throws PluginVersionResolutionException, PluginManagerException
+ {
+ try
+ {
+ Artifact artifact = artifactFactory.createProjectArtifact( plugin.getGroupId(), plugin.getArtifactId(),
+ plugin.getVersion() );
+ MavenProject project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
+ localRepository );
+ // if we don't have the required Maven version, then ignore an update
+ if ( project.getPrerequesites() != null && project.getPrerequesites().getMaven() != null )
+ {
+ DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(
+ project.getPrerequesites().getMaven() );
+ if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
+ {
+ throw new PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
+ "Plugin requires Maven version " + requiredVersion );
+ }
+ }
+ }
+ catch ( ProjectBuildingException e )
+ {
+ throw new PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
+ "Unable to build project for plugin", e );
+ }
+ catch ( IOException e )
+ {
+ throw new PluginManagerException( "Unable to determine Maven version for comparison", e );
+ }
}
protected void addPlugin( Plugin plugin, Artifact pluginArtifact, MavenProject project,
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=220239&r1=220238&r2=220239&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java Thu Jul 21 22:07:47 2005
@@ -24,6 +24,8 @@
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.transform.LatestArtifactTransformation;
import org.apache.maven.artifact.transform.ReleaseArtifactTransformation;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder;
@@ -32,6 +34,8 @@
import org.apache.maven.plugin.registry.TrackableBase;
import org.apache.maven.plugin.registry.io.xpp3.PluginRegistryXpp3Writer;
import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.settings.RuntimeInfo;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.components.inputhandler.InputHandler;
@@ -68,6 +72,10 @@
private ArtifactMetadataSource metadataSource;
+ private MavenProjectBuilder mavenProjectBuilder;
+
+ private RuntimeInformation runtimeInformation;
+
public String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws PluginVersionResolutionException
@@ -86,7 +94,7 @@
// determine the behavior WRT prompting the user and installing plugin updates.
Boolean pluginUpdateOverride = settingsRTInfo.getPluginUpdateOverride();
- // second pass...if we're using the plugin registry, and the plugin is listed in the plugin-registry.xml, use
+ // second pass...if we're using the plugin registry, and the plugin is listed in the plugin-registry.xml, use
// the version from <useVersion/>.
if ( StringUtils.isEmpty( version ) && settings.isUsePluginRegistry() )
{
@@ -140,7 +148,7 @@
( !Boolean.FALSE.equals( rtCheckLatest ) && Boolean.valueOf( pluginRegistry.getCheckLatest() )
.booleanValue() );
- // third pass...if we're checking for latest install/deploy, retrieve the version for LATEST metadata and also
+ // third pass...if we're checking for latest install/deploy, retrieve the version for LATEST metadata and also
// set that resolved version as the <useVersion/> in settings.xml.
if ( StringUtils.isEmpty( version ) && checkLatestMetadata )
{
@@ -148,15 +156,18 @@
version = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), localRepository,
LatestArtifactTransformation.LATEST_VERSION );
- // 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
- updatedVersion = version;
+ if ( version != null )
+ {
+ // 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
+ updatedVersion = version;
- // 3. Persist this version without prompting.
- forcePersist = true;
- promptToPersist = false;
+ // 3. Persist this version without prompting.
+ forcePersist = true;
+ promptToPersist = false;
+ }
}
- // final pass...retrieve the version for RELEASE and also set that resolved version as the <useVersion/>
+ // final pass...retrieve the version for RELEASE and also set that resolved version as the <useVersion/>
// in settings.xml.
if ( StringUtils.isEmpty( version ) )
{
@@ -164,12 +175,15 @@
version = resolveMetaVersion( groupId, artifactId, project.getPluginArtifactRepositories(), localRepository,
ReleaseArtifactTransformation.RELEASE_VERSION );
- // 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
- updatedVersion = version;
+ if ( version != null )
+ {
+ // 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
+ updatedVersion = version;
- // 3. Persist this version without prompting.
- forcePersist = true;
- promptToPersist = false;
+ // 3. Persist this version without prompting.
+ forcePersist = true;
+ promptToPersist = false;
+ }
}
// if we still haven't found a version, then fail early before we get into the update goop.
@@ -183,7 +197,7 @@
if ( settings.isUsePluginRegistry() )
{
// determine whether this build is running in interactive mode
- // If it's not, then we'll defer to the autoUpdate setting from the registry
+ // If it's not, then we'll defer to the autoUpdate setting from the registry
// for a decision on updating the plugin in the registry...rather than prompting
// the user.
boolean inInteractiveMode = settings.isInteractiveMode();
@@ -599,8 +613,8 @@
private String resolveMetaVersion( String groupId, String artifactId, List remoteRepositories,
ArtifactRepository localRepository, String metaVersionId )
+ throws PluginVersionResolutionException
{
- // TODO: check - this was SCOPE_RUNTIME before, now is null
Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, metaVersionId );
String version = null;
@@ -608,13 +622,43 @@
{
metadataSource.retrieve( artifact, localRepository, remoteRepositories );
- version = artifact.getVersion();
+ MavenProject project = mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories,
+ localRepository );
+
+ boolean pluginValid = true;
+
+ // if we don't have the required Maven version, then ignore an update
+ if ( project.getPrerequesites() != null && project.getPrerequesites().getMaven() != null )
+ {
+ DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(
+ project.getPrerequesites().getMaven() );
+ if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
+ {
+ getLogger().info( "Ignoring available plugin update: " + artifact.getVersion() +
+ " as it requires Maven version " + requiredVersion );
+ pluginValid = false;
+ }
+ }
+
+ if ( pluginValid )
+ {
+ version = artifact.getVersion();
+ }
}
catch ( ArtifactMetadataRetrievalException e )
{
getLogger().debug( "Failed to resolve " + metaVersionId + " version", e );
}
-
+ catch ( ProjectBuildingException e )
+ {
+ throw new PluginVersionResolutionException( groupId, artifactId,
+ "Unable to build resolve plugin project information", e );
+ }
+ catch ( IOException e )
+ {
+ throw new PluginVersionResolutionException( groupId, artifactId,
+ "Unable to determine Maven version for comparison", e );
+ }
return version;
}
Modified: maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=220239&r1=220238&r2=220239&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/maven-core/src/main/resources/META-INF/plexus/components.xml Thu Jul 21 22:07:47 2005
@@ -25,6 +25,12 @@
<requirement>
<role>org.apache.maven.plugin.mapping.MavenPluginMappingBuilder</role>
</requirement>
+ <requirement>
+ <role>org.apache.maven.execution.RuntimeInformation</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.project.MavenProjectBuilder</role>
+ </requirement>
</requirements>
</component>
@@ -55,13 +61,21 @@
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
</requirement>
+ <requirement>
+ <role>org.apache.maven.execution.RuntimeInformation</role>
+ </requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.apache.maven.execution.RuntimeInformation</role>
+ <implementation>org.apache.maven.execution.DefaultRuntimeInformation</implementation>
+ </component>
<!--
- |
- |PluginConfigurationDiagnoser
- |
- -->
+ |
+ |PluginConfigurationDiagnoser
+ |
+ -->
<component>
<role>org.apache.maven.usability.ErrorDiagnoser</role>
<role-hint>PluginConfigurationDiagnoser</role-hint>
@@ -223,6 +237,12 @@
</requirement>
<requirement>
<role>org.codehaus.plexus.components.inputhandler.InputHandler</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.project.MavenProjectBuilder</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.execution.RuntimeInformation</role>
</requirement>
</requirements>
</component>
Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java?rev=220239&r1=220238&r2=220239&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java (original)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java Thu Jul 21 22:07:47 2005
@@ -139,17 +139,11 @@
return constructPluginKey( groupId, artifactId, version );
}
- /**
- * @todo remove - harcoding.
- */
public static String getDefaultPluginArtifactId( String id )
{
return "maven-" + id + "-plugin";
}
- /**
- * @todo remove - harcoding.
- */
public static String getDefaultPluginGroupId()
{
return "org.apache.maven.plugins";
Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=220239&r1=220238&r2=220239&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Thu Jul 21 22:07:47 2005
@@ -57,20 +57,17 @@
* Retrieve the metadata for the project from the repository.
* Uses the ProjectBuilder, to enable post-processing and inheritance calculation before retrieving the
* associated artifacts.
- *
- * @todo this a very thin wrapper around a project builder - is it needed?
*/
public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories )
throws ArtifactMetadataRetrievalException
{
- List dependencies;
MavenProject p;
Artifact pomArtifact;
boolean done = false;
do
{
- // TODO: only metadata is really needed - resolve as metadata
+ // TODO: can we just modify the original?
pomArtifact = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion(), artifact.getScope() );
@@ -121,12 +118,11 @@
}
while ( !done );
- dependencies = p.getDependencies();
artifact.setDownloadUrl( pomArtifact.getDownloadUrl() );
try
{
- Set artifacts = createArtifacts( artifactFactory, dependencies, artifact.getScope(),
+ Set artifacts = createArtifacts( artifactFactory, p.getDependencies(), artifact.getScope(),
artifact.getDependencyFilter() );
return new ResolutionGroup( artifacts, p.getRemoteArtifactRepositories() );
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org