you will need to trigger ArtifactResolver.resolveAlways with the artifact, 
localRepository properly populated for each of the requested artifacts..Here is 
an example from maven-netbeans-plugin

 

private void resolve(Artifact artifact, boolean failOnError, boolean remote) 
throws MojoExecutionException { 

129.        if (!artifact.isResolved() || artifact.isSnapshot()) { 
130.            try { 
131.                artifactResolver.resolveAlways(artifact, remote ? 
remoteArtifactRepositories : Collections.EMPTY_LIST, localRepository); 
132.            } catch (AbstractArtifactResolutionException ex) { 
133.                if (failOnError) { 
134.                    throw new MojoExecutionException("can not resolve " + 
artifact, ex); 
135.                } 
136.            } 
137.        } 
138.    }

https://kenai.com/projects/mvn-nb-plugin/sources/subversion/content/src/main/java/com/kenai/maven/netbeans/plugin/NetBeansMojo.java?rev=4

Martin 
______________________________________________ 

  


> Date: Sat, 8 Feb 2014 09:59:27 -0800
> From: desmond.kirr...@gmail.com
> To: users@maven.apache.org
> Subject: Reload MavenProject MavenSession and BuildPluginManager
> 
> How can my Moo reload/refresh MavenProject MavenSession and
> BuildPluginManager components.
> 
> I need to do this after my Mojo switches the a different Git branch.
> 
> 
> 
> --
> View this message in context: 
> http://maven.40175.n5.nabble.com/Reload-MavenProject-MavenSession-and-BuildPluginManager-tp5783698.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 
                                          

Reply via email to