Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 43720 invoked from network); 10 May 2010 13:46:37 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 May 2010 13:46:37 -0000 Received: (qmail 36251 invoked by uid 500); 10 May 2010 13:46:36 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 36146 invoked by uid 500); 10 May 2010 13:46:36 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 36138 invoked by uid 99); 10 May 2010 13:46:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 May 2010 13:46:35 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fajwilson@gmail.com designates 74.125.82.45 as permitted sender) Received: from [74.125.82.45] (HELO mail-ww0-f45.google.com) (74.125.82.45) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 May 2010 13:46:28 +0000 Received: by wwb39 with SMTP id 39so49320wwb.4 for ; Mon, 10 May 2010 06:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=c4lY7eGaYeMMdCUdsbFdw198IzoqJyA9IW/A8/ehNSg=; b=ucfzZ0O8ZrdbYGafgB+r4PkvnjdluYK4Fhb15rPDGxtTg/lk93kEWfuu9TEjcOvp7E 9aWcH+yW1f0MYDKbAyK0+0iFnkKWKxiS2yexz25yU/baSnMCzREZIl5aQzDDVoQvhjZX Bxrqt/JhgthjavD3AKfQOWE7efWWNB9pd5fgg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sin+4uL3SO2jKkJuaH97Ay+3/1OWk39IzctaOtp4gz9qu5q7opWdzn1NDzQ/GmBuNK P619SfIZygg9owEGezmsyq9T7BJhn473XEAE7kwIS6zVcoydy3ThFUQcO5zJeoBGjsb2 pf2VWjhzWmZRKXnrBlOXt0SOT2B5A2EbGfauA= MIME-Version: 1.0 Received: by 10.216.162.147 with SMTP id y19mr2474340wek.0.1273499167866; Mon, 10 May 2010 06:46:07 -0700 (PDT) Received: by 10.216.22.8 with HTTP; Mon, 10 May 2010 06:46:07 -0700 (PDT) Date: Mon, 10 May 2010 14:46:07 +0100 Message-ID: Subject: Importing Ant build files on the classpath with Maven From: Frank Wilson To: user@ant.apache.org Content-Type: multipart/mixed; boundary=0016367fae4985c0a504863da1e8 X-Virus-Checked: Checked by ClamAV on apache.org --0016367fae4985c0a504863da1e8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I've been looking at various ways of importing other ant buildfiles from the classpath to reduce coupling in my multimodule build. This would allow me to checkout only the code and build files I intend to change. I've been looking at using Maven to facilitate this. My solution uses the maven ant-run plugin to run a build.xml file with a classpath that includes a file echo.xml on which build.xml depends (see diagram below= ). However, this requires a few modifications to both ant and the ant-run plugin. The modification to the ant-run plugin is pretty trivial, we just need it to use ant 1.8.1 so we can put types inside , this basically a change to the ant-run pom.xml so that we bring ant 1.8.1 onto the classpath instead of 1.7.1. We then reinstall the ant-run plugin into our repository. Somewhat more siginificant is the change to ant. To support this mechanism we need to be able inherit references in the file being called by the "Ant" task. The Ant tasks supports this, but what is not clear is that it will not export references in the preamble of an ant build file. References are only available within targets. However, since the element cannot exist within a making references in the preable is really necessary in order for this to work. Hence, I made a change to the "Ant" task, so that it brings in import refer= ences before the file (build.xml in the example) is parsed. Consequently, the references should be available in the preamble. The example I have given seems to work ok with this code change. I would like to ask if this tweak to the ant task code is a good idea and whether there is any chance of it or something similar being adopted in ant itself. The change is only one line, but I am worried I might be missing some serio= us consequences. I attach a patch for the ant task which should apply cleanly to the ANT_181 tag on svn. ------- Example ------- BuildCommon Project: -------------------- BuildCommon | +-src | | | +-resources | =A0 | | =A0 +echo.xml // the ant file I want to import. | +-pom.xml // bog standard pom, builds a jar which has echo.xml at the root echo.xml: ********* Hello Modular Ant World!! BuildClient Project: -------------------- BuildClient | +-pom.xml // standard pom, with ant-run executing build.xml in "compile" ph= ase | +-build.xml // the ant file with classpath dependencies that we want to run= . pom.xml ******* // ... standard pom header =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0maven-antrun-plugin =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0compile =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0run =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // ... dependencies build.xml ********* --0016367fae4985c0a504863da1e8 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org --0016367fae4985c0a504863da1e8--