Find Demi Moore in NetBeans IDE 4.1!

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.

Comments:

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!!!

Posted by john.c on June 09, 2005 at 09:03 PM PDT #

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.

Posted by Geertjan on June 09, 2005 at 09:12 PM PDT #

NetBeans as an IDE rocks. This is the first and only one that supports Demi Moore plugins... Talk about RICH client platform! Ludo

Posted by Ludo on June 10, 2005 at 12:10 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today