Hi,

We are trying to extend maven-version-plugin as a standalone java
application to get latest available versions. If we run the plugin from
command-line, it works fine but our custom application fails. The following
is what we are trying to do:

/* ============================================================
class OurMojo extends DisplayDependencyUpdatesMojo {
  OurMojo(String module) {
    super();
    Model model = new Model();
    model.addModule(module);
    MavenProject project = new MavenProject(model);
    super.setProject(project);
  }
  ...
  // set groupId, artifactId, version, type, classifier, scope
  ...
  public void execute() throws ... {
      VersionRange versionRange = VersionRange.createFromVersionSpec(
version );

      super.artifactFactory = new DefaultArtifactFactory();
      Artifact artifact = artifactFactory.createDependencyArtifact( groupId,
artifactId, versionRange, type, classifier, scope );
      
      ArtifactVersion artifactVersion = findLatestVersion( artifact,
versionRange, null, false );
      System.out.println(artifactVersion);
   }
}
============================================================ */

The above code fails at artifactFactory.createDependencyArtifact() with a
NullPointerException. On debug, we reach the following line in
DefaultArtifactFactory:
  ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type
);
However, artifactHandlerManager is never set (or injected) in
DefaultArtifactFactory. 

Any ideas how to get it working?  

We are running the following configuration:
Maven 2.1.0
maven-version-plugin 1.0-alpha-3
-- 
View this message in context: 
http://www.nabble.com/Maven-Version-plug-in-Issue-tp24698056p24698056.html
Sent from the Maven - Issues mailing list archive at Nabble.com.

Reply via email to