X

NetBeans Quick Tip #5 - EOL Sweeper




In the last tip I have shown you how to extend the build process. There are many possibilities how to use ant - take a look at the list of task categories in ant's manual.



Let's say I am working on Linux and I want my sources to always have Windows line endings. Why? So that BFU Windows users can view my source codes in Notepad :-) I can add a single line into the build script (e.g. into the post-compile target):


    <target name="-post-compile">
<fixcrlf srcdir="${src.dir}" eol="crlf"/>
</target>



Whenever I build my project all line endings of my sources are fixed. Note that NetBeans preserves the line ending settings, so it's not necessary to do it everytime. If you don't want to do this during every build (when having too many classes) you can create your own target, which you will call on demand. It is automatically added into the context menu:


    <target name="EOL sweeper">
<fixcrlf srcdir="src" eol="crlf"/>
</target>




EOL sweeper

Isn't ant wonderful?

Join the discussion

Comments ( 3 )
  • Geertjan Wednesday, June 1, 2005
    If you add a description attribute, your new target will not be in "Other Targets", but in the main target list (together with 'clean' and 'compile' and so on). You only have to change the first line of the target:
    <target name="EOL sweeper" description="bla">
  • Geertjan Wednesday, June 1, 2005
    <target name="EOL sweeper" description="bla">
  • Roman Strobl Wednesday, June 1, 2005
    Thanks, Geertjan, it works like charm.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services