maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: How to pass the contents of a file as the value of a command-line parameter when invoking a maven goal
Date Mon, 12 Aug 2013 10:21:01 GMT
The reserve network port mojo is literally the quickest route to success
for you.


On 12 August 2013 10:58, thermaleagle <thermaleagle@gmail.com> wrote:

> Thanks for replying Adrien. I didn't know about that mojo, so will surely
> check it out.
> However,  my problem will be solved the fastest if I can find a way to pass
> the port as a -D parameter to achieve the deadline as the remaining things
> are in place. I can use the suggested mojo as an enhancement in a
> subsequent iteration.
> Any immediate solutions?
> On 12 Aug 2013 14:57, "Adrien Rivard [via Maven]" <
> ml-node+s40175n5767483h84@n5.nabble.com> wrote:
>
> > Hi,
> >
> > Can't you use
> >
> >
> http://mojo.codehaus.org/build-helper-maven-plugin/reserve-network-port-mojo.html
> >  ?
> >
> >
> > On Mon, Aug 12, 2013 at 10:44 AM, thermaleagle <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5767483&i=0>>wrote:
> >
> >
> > > Hi,
> > > I need to pass the contents of a file as the value of a command-line
> > > parameter when invoking a maven goal.
> > >
> > > Why?
> > > The maven goal I am calling would trigger a server process on a certain
> > > port. This goal will be setup in a Jenkins build as a continuous
> > > integration
> > > test job. And there could be more than one such jenkins job. So I want
> > to
> > > ensure that each server process starts on a different port.
> > > I have scanned for an available port in a "pre-build" step and have
> > written
> > > the identified port to a file port.txt and have ensured that it is
> > > available
> > > in the Jenkins job's workspace before the Maven build is triggered.
> > >
> > > What I want to do now is specify a maven goal like below within the
> > Jenkins
> > > job I'm writing:
> > > integration-test clean install -Dport=$(<port.txt)
> > >
> > > Assuming that port.txt only contains a string like "6001", the above
> > > command
> > > should (at runtime) become:
> > > integration-test clean install -Dport=6001
> > >
> > > And when the job runs, a client should connect a url constructed as
> > below:
> > > http://localhost:6001/web_service/myapp
> > >
> > > Note that the port in the above URL is taken from incoming command-line
> > > parameter 'port'.
> > >
> > > However, when I configured this into Jenkins, the job failed with the
> > > stacktrace containg the below:
> > > Caused by: java.net.URISyntaxException: Illegal character in authority
> > at
> > > index 7: <a href="http://localhost:$(">http://localhost:
> $(<port.txt)/web_service/myapp
> >
> > >
> > > I am executing the job on Linux and have verified that $(<..) is
> > supported
> > > on the version of the shell that I am running. So I think replacing
> > > $(<port.txt) with `cat port.txt` is not the answer that might help me.
> > > The problem seems to be lying in the way I'm using the maven
> > command-line.
> > > Looks like the shell is passing everything it sees on the command-line
> > to
> > > Maven which has no clue how to handle it!
> > >
> > > Hope I made the problem clear. All help is appreciated.
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://maven.40175.n5.nabble.com/How-to-pass-the-contents-of-a-file-as-the-value-of-a-command-line-parameter-when-invoking-a-maven-gol-tp5767482.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=5767483&i=1>
> > > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=5767483&i=2>
> > >
> > >
> >
> >
> > --
> > Adrien Rivard
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://maven.40175.n5.nabble.com/How-to-pass-the-contents-of-a-file-as-the-value-of-a-command-line-parameter-when-invoking-a-maven-gol-tp5767482p5767483.html
> >  To unsubscribe from How to pass the contents of a file as the value of a
> > command-line parameter when invoking a maven goal, click here<
> http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5767482&code=dGhlcm1hbGVhZ2xlQGdtYWlsLmNvbXw1NzY3NDgyfC02ODA3NDIyNzQ=
> >
> > .
> > 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/How-to-pass-the-contents-of-a-file-as-the-value-of-a-command-line-parameter-when-invoking-a-maven-gol-tp5767482p5767490.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message