RE: Reload MavenProject MavenSession and BuildPluginManager

2014-02-15 Thread DK
I tried the following but the project version didn't work


Artifact artifact = project.getArtifact();
try {
artifactResolver.resolve(artifact,
remoteArtifactRepositories, localRepository);

System.out.println(project =  + project.getVersion());
System.out.println(artifact =  + artifact.getVersion());
} catch (ArtifactResolutionException ex) {
getLog().error(null, ex);
} catch (ArtifactNotFoundException ex) {
getLog().error(null, ex);
}





--
View this message in context: 
http://maven.40175.n5.nabble.com/Reload-MavenProject-MavenSession-and-BuildPluginManager-tp5783698p5785012.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



RE: Reload MavenProject MavenSession and BuildPluginManager

2014-02-09 Thread DK
Not really an option as this may only run locally and my Mojo may be
configured to only create a local Git branch
On 9 Feb 2014 01:51, mgainty [via Maven] 
ml-node+s40175n5783730...@n5.nabble.com wrote:

  Date: Sat, 8 Feb 2014 09:59:27 -0800
  From: [hidden email]http://user/SendEmail.jtp?type=nodenode=5783730i=0
  To: [hidden email]http://user/SendEmail.jtp?type=nodenode=5783730i=1
  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.
 MGso you have a new feature branch
 MGgit hf feature start ##feature name##

 MGI would set this as a post-create task on a Hudson job  e.g.
 MGand implement 'git hf feature #feature name#' on post-create of Hudson
 Job
 
  --
  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: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5783730i=2
  For additional commands, e-mail: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5783730i=3
 


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://maven.40175.n5.nabble.com/Reload-MavenProject-MavenSession-and-BuildPluginManager-tp5783698p5783730.html
  To unsubscribe from Reload MavenProject MavenSession and
 BuildPluginManager, click 
 herehttp://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5783698code=ZGVzbW9uZC5raXJyYW5lQGdtYWlsLmNvbXw1NzgzNjk4fDk2MTMwOTQ5Mw==
 .
 NAMLhttp://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml





--
View this message in context: 
http://maven.40175.n5.nabble.com/Reload-MavenProject-MavenSession-and-BuildPluginManager-tp5783698p5783778.html
Sent from the Maven - Users mailing list archive at Nabble.com.

RE: Reload MavenProject MavenSession and BuildPluginManager

2014-02-09 Thread Martin Gainty
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
 
  

RE: Reload MavenProject MavenSession and BuildPluginManager

2014-02-08 Thread Martin Gainty
 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.
MGso you have a new feature branch
MGgit hf feature start ##feature name## 

MGI would set this as a post-create task on a Hudson job  e.g.
MGand implement 'git hf feature #feature name#' on post-create of Hudson Job
 
 --
 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