Trigger Maven Release Remotely via cURL












1














With respect to the answer at https://stackoverflow.com/a/52371428/2428979



curl -v -g -X POST 'jenkins.url.com/job/UAT/m2release/submit?json{"parameter": [{"name":"ENVIRONMENT", "value":"uat"}, {"name":"MVN_RELEASE_VERSION", "value":"5.23.0-RC2"}, {"name":"MVN_DEV_VERSION", "value":"5.23.0-SNAPSHOT"}, {"name":"MVN_ISDRYRUN", "value":"true"}]}' --user myusername:mypassword


Using the curl request above I am getting the following error on the terminal along with html/css response, please advise.



I have tried various combinations of the command like adding removing flags and modifying the post data, parameters etc but the error remains consistent.



java.lang.NullPointerException
at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.getString(M2ReleaseAction.java:318)
at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.doSubmit(M2ReleaseAction.java:223)
at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)









share|improve this question



























    1














    With respect to the answer at https://stackoverflow.com/a/52371428/2428979



    curl -v -g -X POST 'jenkins.url.com/job/UAT/m2release/submit?json{"parameter": [{"name":"ENVIRONMENT", "value":"uat"}, {"name":"MVN_RELEASE_VERSION", "value":"5.23.0-RC2"}, {"name":"MVN_DEV_VERSION", "value":"5.23.0-SNAPSHOT"}, {"name":"MVN_ISDRYRUN", "value":"true"}]}' --user myusername:mypassword


    Using the curl request above I am getting the following error on the terminal along with html/css response, please advise.



    I have tried various combinations of the command like adding removing flags and modifying the post data, parameters etc but the error remains consistent.



    java.lang.NullPointerException
    at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.getString(M2ReleaseAction.java:318)
    at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.doSubmit(M2ReleaseAction.java:223)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)









    share|improve this question

























      1












      1








      1







      With respect to the answer at https://stackoverflow.com/a/52371428/2428979



      curl -v -g -X POST 'jenkins.url.com/job/UAT/m2release/submit?json{"parameter": [{"name":"ENVIRONMENT", "value":"uat"}, {"name":"MVN_RELEASE_VERSION", "value":"5.23.0-RC2"}, {"name":"MVN_DEV_VERSION", "value":"5.23.0-SNAPSHOT"}, {"name":"MVN_ISDRYRUN", "value":"true"}]}' --user myusername:mypassword


      Using the curl request above I am getting the following error on the terminal along with html/css response, please advise.



      I have tried various combinations of the command like adding removing flags and modifying the post data, parameters etc but the error remains consistent.



      java.lang.NullPointerException
      at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.getString(M2ReleaseAction.java:318)
      at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.doSubmit(M2ReleaseAction.java:223)
      at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)









      share|improve this question













      With respect to the answer at https://stackoverflow.com/a/52371428/2428979



      curl -v -g -X POST 'jenkins.url.com/job/UAT/m2release/submit?json{"parameter": [{"name":"ENVIRONMENT", "value":"uat"}, {"name":"MVN_RELEASE_VERSION", "value":"5.23.0-RC2"}, {"name":"MVN_DEV_VERSION", "value":"5.23.0-SNAPSHOT"}, {"name":"MVN_ISDRYRUN", "value":"true"}]}' --user myusername:mypassword


      Using the curl request above I am getting the following error on the terminal along with html/css response, please advise.



      I have tried various combinations of the command like adding removing flags and modifying the post data, parameters etc but the error remains consistent.



      java.lang.NullPointerException
      at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.getString(M2ReleaseAction.java:318)
      at org.jvnet.hudson.plugins.m2release.M2ReleaseAction.doSubmit(M2ReleaseAction.java:223)
      at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)






      curl jenkins jenkins-pipeline






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 15:40









      Sagar Sammy

      175




      175
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Hey @SagarSammy I believe that the problem is in absent query parameters for this invocation. U should specify some other mandatory query parameters except of just json



          There are some mandatory query params that have to be present in request, check it out -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L223



          json query parameter will be handled a bit lower through the code -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L235



          Look at the example that was successful for me:



          curl -X POST 
          'https://username:token@{your-jenkins-host}/job/some-job/m2release/submit?releaseVersion=2.1.2
          &developmentVersion=2.1.3-SNAPSHOT
          &isDryRun=on
          &scmUsername={your-scm-username}
          &scmPassword={your-scm-pwd}
          &scmCommentPrefix=[test]
          &json={"parameter": {"name":"CUSTOM_PARAM_NAME1", "value": "CUSTOM_PARAM_VAlUE2"},
          "parameter": {"name":"CUSTOM_PARAM_NAME2", "value": "CUSTOM_PARAM_VAlUE2"}}
          &Submit=Schedule Test Maven Release Build
          -H 'Content-Type: application/x-www-form-urlencoded'
          -H 'Jenkins-Crumb: {your-generated-crumb}'


          I hope this will help you.






          share|improve this answer



















          • 1




            Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
            – Sagar Sammy
            Nov 24 '18 at 18:57












          • For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
            – Sagar Sammy
            Nov 24 '18 at 19:00













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415606%2ftrigger-maven-release-remotely-via-curl%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Hey @SagarSammy I believe that the problem is in absent query parameters for this invocation. U should specify some other mandatory query parameters except of just json



          There are some mandatory query params that have to be present in request, check it out -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L223



          json query parameter will be handled a bit lower through the code -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L235



          Look at the example that was successful for me:



          curl -X POST 
          'https://username:token@{your-jenkins-host}/job/some-job/m2release/submit?releaseVersion=2.1.2
          &developmentVersion=2.1.3-SNAPSHOT
          &isDryRun=on
          &scmUsername={your-scm-username}
          &scmPassword={your-scm-pwd}
          &scmCommentPrefix=[test]
          &json={"parameter": {"name":"CUSTOM_PARAM_NAME1", "value": "CUSTOM_PARAM_VAlUE2"},
          "parameter": {"name":"CUSTOM_PARAM_NAME2", "value": "CUSTOM_PARAM_VAlUE2"}}
          &Submit=Schedule Test Maven Release Build
          -H 'Content-Type: application/x-www-form-urlencoded'
          -H 'Jenkins-Crumb: {your-generated-crumb}'


          I hope this will help you.






          share|improve this answer



















          • 1




            Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
            – Sagar Sammy
            Nov 24 '18 at 18:57












          • For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
            – Sagar Sammy
            Nov 24 '18 at 19:00


















          0














          Hey @SagarSammy I believe that the problem is in absent query parameters for this invocation. U should specify some other mandatory query parameters except of just json



          There are some mandatory query params that have to be present in request, check it out -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L223



          json query parameter will be handled a bit lower through the code -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L235



          Look at the example that was successful for me:



          curl -X POST 
          'https://username:token@{your-jenkins-host}/job/some-job/m2release/submit?releaseVersion=2.1.2
          &developmentVersion=2.1.3-SNAPSHOT
          &isDryRun=on
          &scmUsername={your-scm-username}
          &scmPassword={your-scm-pwd}
          &scmCommentPrefix=[test]
          &json={"parameter": {"name":"CUSTOM_PARAM_NAME1", "value": "CUSTOM_PARAM_VAlUE2"},
          "parameter": {"name":"CUSTOM_PARAM_NAME2", "value": "CUSTOM_PARAM_VAlUE2"}}
          &Submit=Schedule Test Maven Release Build
          -H 'Content-Type: application/x-www-form-urlencoded'
          -H 'Jenkins-Crumb: {your-generated-crumb}'


          I hope this will help you.






          share|improve this answer



















          • 1




            Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
            – Sagar Sammy
            Nov 24 '18 at 18:57












          • For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
            – Sagar Sammy
            Nov 24 '18 at 19:00
















          0












          0








          0






          Hey @SagarSammy I believe that the problem is in absent query parameters for this invocation. U should specify some other mandatory query parameters except of just json



          There are some mandatory query params that have to be present in request, check it out -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L223



          json query parameter will be handled a bit lower through the code -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L235



          Look at the example that was successful for me:



          curl -X POST 
          'https://username:token@{your-jenkins-host}/job/some-job/m2release/submit?releaseVersion=2.1.2
          &developmentVersion=2.1.3-SNAPSHOT
          &isDryRun=on
          &scmUsername={your-scm-username}
          &scmPassword={your-scm-pwd}
          &scmCommentPrefix=[test]
          &json={"parameter": {"name":"CUSTOM_PARAM_NAME1", "value": "CUSTOM_PARAM_VAlUE2"},
          "parameter": {"name":"CUSTOM_PARAM_NAME2", "value": "CUSTOM_PARAM_VAlUE2"}}
          &Submit=Schedule Test Maven Release Build
          -H 'Content-Type: application/x-www-form-urlencoded'
          -H 'Jenkins-Crumb: {your-generated-crumb}'


          I hope this will help you.






          share|improve this answer














          Hey @SagarSammy I believe that the problem is in absent query parameters for this invocation. U should specify some other mandatory query parameters except of just json



          There are some mandatory query params that have to be present in request, check it out -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L223



          json query parameter will be handled a bit lower through the code -> https://github.com/jenkinsci/m2release-plugin/blob/master/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java#L235



          Look at the example that was successful for me:



          curl -X POST 
          'https://username:token@{your-jenkins-host}/job/some-job/m2release/submit?releaseVersion=2.1.2
          &developmentVersion=2.1.3-SNAPSHOT
          &isDryRun=on
          &scmUsername={your-scm-username}
          &scmPassword={your-scm-pwd}
          &scmCommentPrefix=[test]
          &json={"parameter": {"name":"CUSTOM_PARAM_NAME1", "value": "CUSTOM_PARAM_VAlUE2"},
          "parameter": {"name":"CUSTOM_PARAM_NAME2", "value": "CUSTOM_PARAM_VAlUE2"}}
          &Submit=Schedule Test Maven Release Build
          -H 'Content-Type: application/x-www-form-urlencoded'
          -H 'Jenkins-Crumb: {your-generated-crumb}'


          I hope this will help you.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 24 '18 at 14:35

























          answered Nov 24 '18 at 14:30









          Dzmitry Hubin

          1267




          1267








          • 1




            Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
            – Sagar Sammy
            Nov 24 '18 at 18:57












          • For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
            – Sagar Sammy
            Nov 24 '18 at 19:00
















          • 1




            Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
            – Sagar Sammy
            Nov 24 '18 at 18:57












          • For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
            – Sagar Sammy
            Nov 24 '18 at 19:00










          1




          1




          Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
          – Sagar Sammy
          Nov 24 '18 at 18:57






          Thanks @Dzmitry for taking the time out and answering my question. This worked perfectly.
          – Sagar Sammy
          Nov 24 '18 at 18:57














          For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
          – Sagar Sammy
          Nov 24 '18 at 19:00






          For anyone who stumbles across this, just goto the jenkins job webpage enter values and submit while capturing the network request/response headers and create a cUrl based on that!
          – Sagar Sammy
          Nov 24 '18 at 19:00




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415606%2ftrigger-maven-release-remotely-via-curl%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'