X

Geertjan's Blog

  • June 10, 2005

Find Demi Moore in NetBeans IDE 4.1!

Geertjan Wielenga
Product Manager
In Save Demi Moore in NetBeans IDE 4.1!, you saved the Demi Moore macro by using an Ant script that you integrated into NetBeans IDE 4.1:

  <target name="save-demi-moore" description="Save Demi Moore">
<copy todir="c:\\DemiMoore\\config">
<fileset dir="C:\\Documents and Settings\\${user.name}\\.netbeans\\${release.number}\\config"/>
</copy>
</target>

But notice how clumsy the fileset is! You need to define the ${user.name} and ${release.number} in a project.properties file first, and then import it into your build.xml file, otherwise the save-demi-moore target doesn't work. To be more correct, in fact, you'd need to define the whole path to the config directory in a project.properties file. After all, what happens when the path to the user directory changes? Therefore, the fileset should probably be like this:

<fileset dir="${path.to.my.user.directory}\\config"/>

However, when you run the Ant script introduced in yesterday's blog entry, something really cool happens. Try it. Put this Ant script in your build.xml and then run it:

<target name = "echoprops" description = "echoprops">
<echoproperties destfile="nbproject/demimoore.properties"/>
</target>

Now go to the nbproject folder in the Files window and notice that there is a demimoore.properties file. Expand the node in the Files window and then expand it again. You'll see a long list of properties. Keep scrolling down and you'll find these:

These could be quite useful in an Ant script, right? If, for example, you double-click netbeans.user, you'll see this in the Source Editor:

netbeans.user=C\\:\\\\Documents and Settings\\\\Administrator\\\\.netbeans\\\\dev

Now, correct me if I'm wrong, but isn't that where the Demi Moore macro lives? So, you don't even need to create a property for the user directory, because it's already there. And without the echoprops target, you would never have known about the netbeans.user property! So, now you can change the save-demi-moore target so that it is as follows:

  <target name="save-demi-moore" description="Save Demi Moore">
<copy todir="c:\\DemiMoore\\config">
<fileset dir="${netbeans.user}\\config"/>
</copy>
</target>

And another cool thing is that the IDE knows about all of these properties automatically, so you don't need to import the demimoore.properties file in your build.xml file. You can just run the target as if you knew where Demi Moore lived all along.

Join the discussion

Comments ( 3 )
  • john.c Friday, June 10, 2005
    Geertjan, I think your obsession with Demi Moore is getting out of hand. Ashton Kutcher called me and said that if you build any more Ant scripts with his girlfriend in them, he's gonna kick yer butt!!!
  • Geertjan Friday, June 10, 2005
    I'll be ready for him. I've got a very efficient little "delete-ashton" Ant script that's got his name all over it.
  • Ludo Friday, June 10, 2005
    NetBeans as an IDE rocks. This is the first and only one that supports Demi Moore plugins...
    Talk about RICH client platform!
    Ludo
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.