Monday, 11. May 2009 12:16
So time keeps going and therefore I had recently my first contact with Nant.
As I have worked for years with Ant in all my Java Projects I really was excited to have a deeper look into Nant.
So, what about to say, they do a really good job there. It took me at least only a few minutes to transfer my Ant-Knowledge
to Nant. Ok, I was a few tasks missing that I really often use with ant in Automation like parallel and Macros.
But to keep this to the point for Ant-Users here are my main points to keep in mind using Nant:
- Property has no file attribute. To load external Properties put them into a Nant-Script (<name>.build) and use the import-Task
- Include Nant-Contrib to your scripts, as useful as Ant-Contrib to Ant
<loadtasks assembly="PATH-TO-NANT-CONTRIB/bin/NAnt.Contrib.Tasks.dll" /> |
- Property-Usage! This is really a difference to Ant foremost if you have to use Nant-Functions. If you want to use more than one Property passed to the function, keep in Mind that you
just have to use the Property-Braces once! Example:
...
<property name="nant.home"
value="${environment::get-variable('NANT_CONTRIB_HOME')}"/>
<property name="nant.contrib.dll"
value="bin/NAnt.Contrib.Tasks.dll"/>
<echo message="${path::combine(nant.home, nant.contrib.dll)}"/>
... |
- To call a specific build file use nant /f:file.build instead of ant -f filebuild.xml
- In Nant you often have to use functions instead of properties
With these points in mind it will be no problem to write Nant-Scripts if you have Ant-Experience.