I'm writing a mojo which, among other things, needs to add dependencies to the 
project at runtime. At first, this seemed straightforward enough:
   
  Dependency dep = new Dependency();
  dep.setGroupId("groupId");
  dep.setArtifactId('artifactId");
  dep.setVersion("1.0");
  dep.setScope("compile");
  dep.setType("jar");
  project.getModel().addDependency(dep);
   
  ...however, when a later mojo @requiresDependencyResolution, it all blows up 
in my face, and I can't really tell why from the exception. Most likely I'm not 
going about this the right way - some pointers would be appreciated.
   
  java.lang.NullPointerException
        at 
org.apache.maven.artifact.DefaultArtifact.equals(DefaultArtifact.java:300)
        at java.util.HashMap.eq(HashMap.java:277)
        at java.util.HashMap.put(HashMap.java:386)
        at java.util.HashSet.add(HashSet.java:194)
        at 
org.apache.maven.project.artifact.MavenMetadataSource.createArtifacts(MavenMetadataSource.java:365)
        at 
org.apache.maven.project.MavenProject.createArtifacts(MavenProject.java:1415)
        at 
org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1118)

                
---------------------------------
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.

Reply via email to