Sunday, October 28, 2007

Upgrade to Leopard, the story so far

I was really looking forward to upgrading to Leopard today but I'm not sure if I'm happier now that it's all done. Apple is starting to do some really stupid things lately. I've been a Apple/Next user/developer since 1992, eight years on Next and the last seven years on Apple. I have to ask, what the hell are they thinking? No Java 6 support, key bindings removed for Front Row, you cannot use an AirDisk with Time Machine, AirDisks don't work and so on. I guess I'll have to see how things go over the next week or two, but I'm not going to install Leopard on any other mac in my house till things get better. On a similar note, I bought a Apple TV a few months back and returned it after two days. I've never been unhappy with an Apple product before, but this seems to be becoming a trend :-) I love my iPhone, but Apple's tendency to control every aspect of my computer is really starting to piss me off. BTW, wtf is up with Front Row, when I browse out of the "Music" section the music stops, Front Row 1.x didn't do this, it played music till you picked something else for it to play. I'm going to watch a movie, I'm sure that will be more enjoyable than the last hour has been.

Thursday, October 11, 2007

Getting Maven and Eclipse to work together to filter resources

I don't really care for any of the Eclipse plugins currently available for Maven (m2eclipse or Q4E), however I do like the Maven plugin for eclipse (it seems to be the only one that works). At Overstock.com everyone uses Eclipse, so as we are moving to Maven it is important that Maven work well in the IDE. Most folks checkout their code, develop and then check there code back into svn via Eclipse, never hitting the command line. Obviously, the Maven Eclipse plugin won't be good for them, so currently we are using m2eclipse for Eclipse/Maven integration. One of the problems I've been running into is filtering resources, I believe if you are using m2eclipse and you choose (from the popup menu) Maven -> Update Source Folders all your resources will be filtered (if you have filtering turned on in your pom.xm). I don't want to do that and folks will forget to do it, furthermore, since I do use the Maven Eclipse plugin (requiring the command line) and I don't use m2eclipse, this won't work for me. So how do you get Maven and Eclipse to work together? This feature request for m2eclipse provides some pointers. Eugene suggests using a Maven build(er), but I cannot do that (because I'm not using m2ecilpse and I couldn't get it to work correctly when I tried), so I'll use a Program builder instead. In the Package Explorer, right click on your project and select properties, this brings up the Properties for xxx dialog box. In the list on the left, choose Builders, as shown in the image below (click on any of the images below for a larger version): Next, click the New... button and choose the Program builder: In the Properties for New_Builder (1) dialog box, use the Browse File System... button to locate your copy of the mvn executable. For the Working Directory section, click the Browse Workspace... button and select your project. For the Arguments section add the following:
resources:resources resources:testResources
Here is how the dialog should look like so far: To finish things off, select the Build Options tab at the top of the Properties for New_Build (1) dialog box and make sure the During auto builds check box is selected (actually you want all check boxes under Run the builder to be checked except for During a "Clean"). Next select the Specify working set of relevant resources check box and then click Specify Resources.... In the dialog box that pops up, navigate to your src/main/resources and src/test/resources folders and click the check box to the left so these folders are included in your working set, click Finish. Here is what the Build Options tab should look like: That's it, now when you refresh your workspace, try to run a unit test, etc. all your resources are filtered just as if you were doing it from the command line. If you have a way to do this correctly with m2eclipse or Q4E please let me know. Update: you may want to add the -o command line switch for Maven so that it doesn't try to look for JARs to download. You will want to add -o to the resources:resources... code above. Update 2: If you are using the m2eclipse plugin, check out Eugene Kuleshov's response to this post. Also, if you decide to keep using an external builder, you'll want to make sure the "Refresh resources upon completion." check box is selected on the Refresh tab of the builder dialog box. Update 3/12/08: In the "Build Options" section above you'll need to select all options under "Run the builder", so that it runs both during and after a clean. Also, I no longer use the m2eclipse builder, I only use a Program Builder.

Wednesday, October 10, 2007

Welcome to the Twilight Zone

Since I'm caught up on the latest Java Posse episode, I thought I'd listen to the radio on my way into work today. It turns out my local NPR station just started it's fall membership drive. After about five minutes of listening, one of the local sponsor's (a car dealership) joked about programming everyone's car radios to always tune to an NPR station. Laughing, I decided to switch stations, well guess what? Every station I turned to was NPR. No kidding, it was so bizarre that I had to call my wife to tell her. When I turned the radio back on, it was on another station. Then when I went back to NPR, all stations played NPR. I'm not sure what was going on but it seems that my radio only wants NPR ;-)