I'm by no means an accomplished Mojo author but I have learned the most by
simply copying an existing Mojo and chipping away the existing code until I
understood what each part did and how.

In your case I would simply take the working StatusMojo.java (?) as a whole
and throw out the code you don't need. Don't forget to include the scm
plugin as dependency of your plugin.

Lenni


On Mon, May 30, 2011 at 4:58 PM, Kalpak Gadre <[email protected]> wrote:

> Hi,
>
> I am developing a Mojo for manipulation of JIRA while making a release.
> This mojo is required to manipulate issues and generate release notes. The
> process is very specific to the client. As part of the process, I need to
> commit the newly generated release notes to SCM. I also need to ensure that
> there are no local changes in project (similar to release:prepare)
>
> How can I utilize existing functionality of scm:status and scm:commit
> mojos? I tried extending the AbstractScmMojo from maven-scm-plugin to get
> handle to the ScmManager object. Since most of the code was already in place
> at AbstractScmMojo it made sense to extend my Mojo from this class, No?
>
> With this approach though, my Mojo fails with,
>
> Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to create
> SCM repository.
>    at
> in.firestart.maven.plugins.release.JiraReleasePrepareMojo.execute(JiraReleasePrepareMojo.java:78)
>    at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>    at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>    ... 19 more
> Caused by: org.apache.maven.scm.ScmException: Can't load the scm provider.
>    at
> org.apache.maven.scm.plugin.AbstractScmMojo.getScmRepository(AbstractScmMojo.java:362)
>    at
> in.firestart.maven.plugins.release.JiraReleasePrepareMojo.execute(JiraReleasePrepareMojo.java:68)
>    ... 21 more
> Caused by: java.lang.NullPointerException: You need to define a
> connectionUrl parameter
>    at
> org.apache.maven.scm.plugin.AbstractScmMojo.getConnectionUrl(AbstractScmMojo.java:249)
>    at
> org.apache.maven.scm.plugin.AbstractScmMojo.getScmRepository(AbstractScmMojo.java:298)
>    ... 22 more
>
> The scm connection and developerConnection both are configured correctly
> and mvn scm:status works perfectly well on the same project. Looking at the
> error, it looks like plexus is not wiring the connectionUrl attribute. I am
> a noob at writing Mojos and plexus in general. Do we need to explicitly
> request Plexus to inject components into our Mojo? Please advice.
>
> Here is my environment,
>
> maven-scm-plugin version: 1.5
> Maven version: 3.0.3
>
> Thanks,
>
> Kalpak
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to