You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by DK <de...@gmail.com> on 2014/02/08 18:59:27 UTC

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Reload MavenProject MavenSession and BuildPluginManager

Posted by DK <de...@gmail.com>.
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+s40175n5783730h75@n5.nabble.com> wrote:

> > Date: Sat, 8 Feb 2014 09:59:27 -0800
> > From: [hidden email]<http://user/SendEmail.jtp?type=node&node=5783730&i=0>
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=5783730&i=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.
> MG>so you have a "new feature branch"
> MG>git hf feature start ##feature name##
>
> MG>I would set this as a post-create task on a Hudson job  e.g.
> MG>and 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=node&node=5783730&i=2>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5783730&i=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 here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5783698&code=ZGVzbW9uZC5raXJyYW5lQGdtYWlsLmNvbXw1NzgzNjk4fDk2MTMwOTQ5Mw==>
> .
> NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=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

Posted by Martin Gainty <mg...@hotmail.com>.
> Date: Sat, 8 Feb 2014 09:59:27 -0800
> From: desmond.kirrane@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.
MG>so you have a "new feature branch"
MG>git hf feature start ##feature name## 

MG>I would set this as a post-create task on a Hudson job  e.g.
MG>and 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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
 		 	   		  

RE: Reload MavenProject MavenSession and BuildPluginManager

Posted by DK <de...@gmail.com>.
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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Reload MavenProject MavenSession and BuildPluginManager

Posted by Martin Gainty <mg...@hotmail.com>.
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.kirrane@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>