Thursday, November 6, 2008

More Maven Best Practices @ ApacheCon by Brett Porter

Here are my notes from Brett's talk about Maven.
More Apache Maven Best Practices, by Brett Porter General Principles from last years presentation
  • Set up your environment in advance
  • A repository manager is a must (e.g. Archiva)
  • Keep your POM simple, write your build like you write code
  • Keep the build portable
  • Avoid hard coding
  • Make artifacts portable and minimize resource filtering 
  • Keep db config out of the project 
  • Make sure the build is reproducible
  • Lock down versions, lock down environmental variations (don't rely on getting the latest, use version numbers)
  • Use the Enforcer plugin (http://maven.apache.org/plugins/maven-enforcer-plugin/)
  • Use this plugin to ensure other modules do not use automatic versions like latest and latestRelease
  • Release your project early and often
Dependency Management
  • Transitive dependencies are a big part of Maven, however sometimes dependencies get messed up, use mvn dependency:tree to analyze your dependencies. 
  • Use enforcer plugin to ban specific dependencies and then you can use global exclusions to keep that dependency out of the project
  • Specify only what you need, specify scope, USE dependencyManagement
  • Use dependency:analyze, find out what you're using but not declaring, find out what you're declaring but not using
Integration Testing
  • Unfortunately, an afterthought in Maven 2.0.x, at least in lifecycle
  • Tests in a separate module, tests in same project, you'll most likely need to use profiles
  • In Maven, plugin ITs are in the project
  • Using a separate project, most common pattern in Maven. If you're testing multiple modules put tests in another module
  • create a parallel module, use the regular src/test/java directory, add a dependency on the module being tested, you will typically put this in a profile to control when it's run (e.g. in your CI env)
  • If you are testing in the same project (e.g. a plugin or framework example), use another source dir, like src/it or use the src/test/java path and exclude a package from the general test so they can be used during integration testing (this is the easiest approach)
Maven sites and reporting
  • There are two technologies working here, reporting and rendering, they are not the same thing!
  • Site tips, avoid reports and documentation sites, some minimal project reports, like mailing lists, source repository may be relevant
  • use site inheritance, just like in your pom, you can break down the site.xml file, they sit along side your pom.xml file
  • Use versioning in the URL
  • Include release notes in the versioned usage documentation
  • Report tips
    • Set up what you'll use! Don't create reports with thousands of issues
    • It won't be used if, too much information or there is irrelevant information
    • Don't settle for the default settings
  • Use active checks, not passive reports, fail the build
  • Use profiles to control reports, you don't need to run the reports all the time
Plugin Development
  • Sometimes it is easier to use a script for short, one-off, customizations, e.g. antrun plugin, jrubygroovy plugin, etc.
  • If you might use it twice, consider writing a plugin
  • Writing a plugin isn't a big deal, you can write it in Java, Ruby, Groovy, etc.
  • Write your functionality in components, with the Mojo as a "wrapper"
  • Minimize Maven API dependencies and component exposure, e.g. use maven-artifact, not maven-core (be aware of your dependencies, only use what you need)
  • Do as we say, not as we do. Maven fails to implement many of these practices in various projects. Maven commiters learned the hard way!
You can get Brett's slides here.

Friday, August 8, 2008

Seam and Maven

A while back I mentioned that I'd post a Maven project that would make building Seam applications with Maven a little easier. Here it is, I've got three projects actually. For the impatient, you can see all the projects over here on Google code. The three projects I created are:
  1. basic-settings, this is a parent pom project to define the JBoss repository, set your compiler to Java SE 5 (Maven defaults to Java SE 1.3), and sets some defaults for the Maven eclipse plugin.
  2. seam-dependencies this project defines all your Seam dependencies. You will use this as a dependency in your Seam project. This defines the Hibernate and Seam JARs you need to get your Seam application working.
  3. seam-example this is a sample application that uses both basic-settings and seam-dependencies, to illustrate how to put it all together. This application is a simplified version of the JPA-booking example that comes with Seam.
These projects do not use Java EE in any way, so there isn't even a JBoss embedded dependency. My reason for doing this was to make building and deploying an application as easy as possible. To get to the projects, you need to download the the source from my Google code project, which you can find here, once at the project page, click the "Project" tab and that will tell you how to check out the code. Now that you've got the code checked out, run mvn install for these projects:
  1. basic-settings
  2. seam-dependencies
With everything installed, you can try out the seam-example project. To run the project, use the Maven Jetty plugin, like this:
cd seam-example
mvn jetty:run
You can access the app from port 9090, using this URL: http://localhost:9090/seam-example I also did a Seam presentation at the July 2008 UJUG meeting. You can see the presentation here.

Wednesday, April 2, 2008

Accepted into the iPhone Developer Program

I was surprised last night with an email from Apple letting me know that my application to join the iPhone Developer Program had been accepted. I started my career as a NEXTSTEP developer so coming back to Mac OS X should be a lot of fun. I have a couple of ideas for iPhone apps, now if I could only change time like Dubya and get 30 hours in a day :-) Stay tuned, I'll post info on the apps I attempt to create here.

Thursday, March 6, 2008

iPhone SDK now available

I totally forgot that today Apple had an iPhone event scheduled for today. I'm currently watching the session while I write this. I just signed up for the iPhone SDK and cannot wait to get back into Objective-C. I used to be a NeXT (predecessor to Mac OS X) developer so seeing some of the familiar API's and language will be great. The best part is the Exchange integration that will be coming in June, finally I will be able to get my work email on my iPhone (wait, is that something I really want?). So are you going to build your own iPhone apps? As I start to develop some apps, I'll post my experiences here asap.

Sunday, March 2, 2008

JavaPosse Roundup 2008

I'm off to the JavaPosse Roundup 2008 tomorrow morning (Monday March 3, 2008). Three of us from Overstock.com are going together. It should be a real blast. Late last year, James Ward of Adobe came out to speak at the November UJUG meeting about Flex. After the meeting we were out at a local pub called, Red Rock and James said if there was one conference you were going to go to in 2008, the Java Posse Roundup 2008 should be it. So I'll be there tomorrow afternoon, and cannot wait to meet everyone and to go skiing at Crested Butte. I also put together a collection of past Posse episodes for the drive down, here they are: See you there!

Update on my dad

A quick update on my dad. After having a stroke on January 31, 2008, and a good family friend passing away a few days later, I'm happy to say that my dad has come home. After being in the hospital for about three weeks and catching the virus that caused the hospital to be locked down (meaning that he had no visitors for 10 days right after Bill K passed away), he was discharged because the virus had another breakout. Last weekend was a little scary, his blood sugar levels were way up, and his blood pressure was too high. My mom tried to reach a doctor but no one was available (the Canadian health care system for you). My folks finally got to a doctor on Wednesday and it turns out that he had the wrong prescription for his diabetes. Once the prescription was straightened out, he started to feel better. It will take several weeks for him to really feel the full impact of the medication but I can hear it in his voice already. He is starting to do much better. One more good thing, he can talk like his old self, fortunately the stroke only affected his balance which he is working on correcting. To everyone that contacted me, thank you very much for your thoughts, concerns, and comments. Dad - its great to have you back home, I love you very much!

Wednesday, February 27, 2008

Guitar Hero III - Where have you been?

For Christmas my wife and I got our family (we have three boys 11, 10, and 9) an XBox 360. But not any old XBox, the Halo 3 edition. My 10 year old and I have been playing Halo for years (Halo and Halo 2), so getting the 360 late last year once Halo 3 came out, seemed a no brainer. Since I'd been playing Half Life 2 for a while on our old XBox, my wife also got me the Organge Box for Christmas (great set of gifts btw, thanks honey). I've always liked Halo but Half Life is a way more engaging game, the physics are better, you can interact with just about everything and the gravity gun is hard to beat. I also think the the story is way more interesting. However, for pure game play, not much else comes close to Portal, Valve's new game introduced as part of the Orange Box. So Christmas was great I played a lot of Half Life 2 and Half Life 2 Episode One (almost finished). Then it happened... A couple of weeks back we were at our local Best Buy and they had a pallet of Guitar Hero III wireless guitar and game bundles. We've been talking about getting Rock Band so we could all play, but we thought we'd start with GH3 first. When we got home I started to play on easy to get the feel of the game and ended up almost finishing the solo-career game. I'm not sure how to describe the experience you get playing the game but the first thing that came to mind was "this is the ultimate air guitar experience." If you've ever listened to your favorite song and wished you could play the guitar (I know, I should have learned to play the guitar, but I didn't and now I'm too lazy), then GH is for you. After playing for a couple of weeks, my wife started to play and it has been a blast. We are almost through the co-op career on Medium but Knights of Cydonia is kicking our ass! So if you were wondering where the Seam Maven archetype is, now you know, GH3 has taken all my free time, and what a great ride it's been. BTW, now I find myself wishing all my favorite songs were in GH3. While driving to work I keep thinking, I want to play that on my plastic wireless guitar :-)

Thursday, February 14, 2008

Overstock.com and Seam

As I mentioned a while back, I now work at Overstock.com. One of the things I've been working on for a couple of months is bringing JBoss Seam to Overstock. First off, just to clarify where we are using Seam: We will not be using Seam for the public Overstock.com website, the one you might be familiar with here however; we will be using it for internal application development. This is a really exciting time for me at Overstock because I'm helping to usher in some new technologies like Seam and my other favorite open source project, Maven. Since something like Seam is new to Overstock, I've had to put together some training courses, get "the seam Book" and put together a Maven Archetype to jump start projects. Over the next couple of days, I'll be posting a working pom file (along with a download) you can use for your own Seam/Maven project. My efforts are based on Michael Yuan's posts about Seam and Maven, with tweaks so you don't have to inherit from the Seam pom. One last thing on the Seam front, in case you missed it, there is a new Seam community site now available. The best part of all is that it is built on Seam. If you cannot eat your own dog food than your framework sucks :-)

Sunday, February 3, 2008

Goodbye to a family friend

On Thursday, January 31st my Dad, Bill Maki, and a stroke. What I didn't know till later in the day was that a longtime family friend (45+ year and my Dad's best friend, Bill Kapush (another Bill), was admitted to the hospital with chest pain. There is only one hospital in my home town and they were down the hall from one another. The next day, Friday February 1st, while still in the hospital, in the care of a nurse and in mid sentence, Bill Kapush put his head down and died! I couldn't believe it, on Wednesday, January 30th, Bill Kapush, Bill Maki, and my mom were having dinner together and everything seemed okay. Two days later and my dad has had several strokes, has been diagnosed with dimensia and cannot talk too well and Bill Kapush is dead. My dad and Bill had stated to talk to one another every day for the last few years, it was part of their routine, another change my dad will have to make. I'd like to offer my condolences to the Kapush family, I know it was a big shock to all of you and my thoughts and prayers are with you. If you live near your parents, why don't you drop by and say hi, if you don't live near them call them today to say hi, or better still let them know you love them, you never know how fast life can change everything.

Thursday, January 31, 2008

A very sad day

Unlike my usual posts, this one is not technical in nature. I've had a really rough day and wanted to record it so I could look back and remember how things went. So today is my birthday, another year older and probably the scariest day of my life so far. This morning around 8:30 my folks called to wish me a happy birthday and when I talked to my dad (who is 76 btw) I noticed he was having a real hard time talking, then he started to slur, at that point I realized something was up. My mom took my dad to the ER and it turns out that he had had a stroke, a couple perhaps. Unfortunately, there was worse news, he has dementia. I guess this explains why my mom has beens saying for a while that my dad is forgetting things, not aware of what's happening, etc. I think the scariest thing, for me at least, is talking to him. He doesn't sound like my dad, and when he talks I just want to hug him and make it better (I guess that's what happens when you yourself are a dad). It seems that he isn't really aware of his diagnosis, so maybe that is a good thing. So have you had a loved one that has gone through this? If so, how did you handle it? What did your family do, did they gather around one another or stay away? I was planning on going to my home town tonight but my mom asked me not to, to give them a few days to work it out. Dad - if you read this, I love you and hope you know what a great dad you are!