maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thermaleagle <thermalea...@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:03:20 GMT
That's a great idea Robert! Will keep it as reference.
However,  unable to implement it since I don't manage the build server and
touching settings. Xml will throw me in a series of approvals across a huge
team of stakeholders that will take more than the available time.
On 12 Aug 2013 15:17, "Robert Scholte-4 [via Maven]" <
ml-node+s40175n5767489h70@n5.nabble.com> wrote:

> Hi,
>
> This is how we solved this problem:
> On the Jenkins buildserver we added the following to our settings.xml
>
> <profiles>
>    <profile>
>      <id>jenkins</id>
>      <properties>
>        <port>600${EXECUTOR_NUMBER}</port> <!-- port could be for any
> plugin, so not really a good name -->
>      </properties>
>    </profile>
> </profiles>
>
> <activeProfiles>
>    <activeProfile>jenkins</activeProfile>
> </activeProfiles>
>
> This assumes a maximum of 10 executors on the buildserver.
> Now you don't have to specify the port on the commandline, it'll be picked
>
> up from these settings.
>
> I'm not sure anymore if we had to expose these JENKINS variables and if it
>
> had to be prefixed with "env.", but this should be enough info to solve
> your problem.
>
> Robert
>
> Op Mon, 12 Aug 2013 10:44:00 +0200 schreef thermaleagle
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5767489&i=0>>:
>
> > 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=5767489&i=1>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767489&i=2>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767489&i=3>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5767489&i=4>
>
>
>
> ------------------------------
>  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-tp5767482p5767489.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-tp5767482p5767491.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message