You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Brian E. Fox" <br...@reply.infinity.nu> on 2007/01/22 04:28:52 UTC

version range resolution inside plugin

I'm trying to resolve mdep-50. Inside the dependency plugin, I use 

public Artifact createArtifact( String groupId, String artifactId,
String version, String scope, String type )

 to create the artifact. I pass in the range from the plugin
configuration ( [3.7,4.0) for example ) directly to this method without
any preprocessing. This method seems to eventually check the version: 

DefaultArtifactFactory line 103:

      VersionRange versionRange = null;

        if ( version != null )

        {

            versionRange = VersionRange.createFromVersion( version );

        }

        return createArtifact( groupId, artifactId, versionRange, type,
classifier, scope, inheritedScope );

 

After creating this artifact, I call resolver.resolve( artifact,
remoteRepos, local ); (resolver,remoteRepos and local are injected by
maven)

 

The trouble is, that is appears the version was never handled properly:

 

Downloading:
http://repo1.maven.org/maven2/junit/junit/[3.7,4.0)/junit-[3.7,4.0)

.jar

[WARNING] Unable to get resource from repository central
(http://repo1.maven.org

/maven2)

[INFO]
------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO]
------------------------------------------------------------------------

[INFO] Failed to resolve artifact.

 

GroupId: junit

ArtifactId: junit

Version: [3.7,4.0)

 

Reason: Unable to download the artifact from any repository

 

Try downloading the file manually from the project website.

 

Then, install it using the command:

    mvn install:install-file -DgroupId=junit -DartifactId=junit \

        -Dversion=[3.7,4.0) -Dpackaging=jar -Dfile=/path/to/file

 

 

  junit:junit:jar:[3.7,4.0)

 

from the specified remote repositories:

  Maven Snapshots (http://people.apache.org/maven-snapshot-repository),

  central (http://repo1.maven.org/maven2),

  Codehaus Snapshots (http://snapshots.repository.codehaus.org/maven2/)

 

 

Is this a known issue that you can't resolve a version range dynamically
or did I just plain miss a step?

 

Thanks,

Brian