Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7E942104C4 for ; Mon, 12 Aug 2013 23:27:57 +0000 (UTC) Received: (qmail 37635 invoked by uid 500); 12 Aug 2013 23:27:55 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 37555 invoked by uid 500); 12 Aug 2013 23:27:55 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 37547 invoked by uid 99); 12 Aug 2013 23:27:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Aug 2013 23:27:55 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of vektor.knight@gmail.com designates 209.85.223.180 as permitted sender) Received: from [209.85.223.180] (HELO mail-ie0-f180.google.com) (209.85.223.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Aug 2013 23:27:51 +0000 Received: by mail-ie0-f180.google.com with SMTP id aq17so9315910iec.11 for ; Mon, 12 Aug 2013 16:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=DdrIpGkaYw4qfH+SQCOUCbh1PG9iSXTtOAuEUZpFlT8=; b=PKtEug99btODB+UySsPTSgmdvfsf7Ax2Xo3/baMayqeb8OFiY+SGvklfaKbtHFc1oK 1HwtQ3lujVMMwiX8xoUvXqB3WV5xmuMAPlkNHYR3OINaXqBmjhQCatuBZge7GPl2+jDw aChpqH4IDnPn/PmDr9WfJAJulGSOVkuHu5WkpOVWWhUa2t3p/gfM79X56L3LinKQ1Ofd 5WN2eU1Z09pqeBrMW01Q1THq0yqI693y6o75FKQ4cSwg1qO635dfnOED/YdwWOmCqokL Nlzf7sa6RQAg/B2dBJXzC848XENF5bG+voUQBj80nUL+jlv51wldGxJlTtx7UxRf7/gb ryWA== X-Received: by 10.50.44.35 with SMTP id b3mr898128igm.7.1376350050531; Mon, 12 Aug 2013 16:27:30 -0700 (PDT) Received: from [192.168.1.85] ([173.181.42.207]) by mx.google.com with ESMTPSA id vf9sm592838igb.1.2013.08.12.16.27.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 16:27:29 -0700 (PDT) Message-ID: <52096F5F.4000807@GMAIL.COM> Date: Mon, 12 Aug 2013 17:27:27 -0600 From: SARTAJ HUNDAL User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: Maven Users List Subject: Re: How to pass the contents of a file as the value of a command-line parameter when invoking a maven goal References: <1376297040974-5767482.post@n5.nabble.com> In-Reply-To: <1376297040974-5767482.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 13-08-12 02:44 AM, thermaleagle 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=$( > 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: http://localhost:$( > 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 > $( 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. > > a. Read each line of port.txt and store as ${line} > > -- > 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: users-unsubscribe@maven.apache.org > For additional commands, e-mail: users-help@maven.apache.org > I. Your error is with respect to the URI (uniform resource identifier) syntax being presented to Java.net. ii. Java objects are not inherited in XML, but can be passed in with a pre-processing step. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For additional commands, e-mail: users-help@maven.apache.org