Idea OSX And Maven

So I got a custom install of Maven because I’m trying to share configs with other people in my company. And I use multiple machines which all have the custom Maven install in a different path. It’s on a C drive for windows, under a java-apps folder on OSX, and under ~/Programs/JavaApps on Linux. Everytime I open the same project from different machines I have to set the location of Maven’s home folder. so then I accidentally run a Maven goal without setting the home folder one day under the later Idea build and it prompts me to either set the home folder for Maven in the config dialog or set a M2_HOME environment variable. (It never prompted in the earlier 7.x- releases, mind you.) Cool! I set the env var in Windows and Linux and forget completely about Mac because I mostly use XCode there. Tonight I attempted to point my Mac to an ‘.ipr’ on a network drive since my Linux box was cuttin’ up and it hits me again. But wait! How do I set the env var on OSX? (In Windows/Linux IU cheated and edited the ides batch/shell scripts.) I browse the Info.plist in the ‘.app’ bundle to no avail. Then I turn to Google. I found a tip that explains that you can set global env vars in OS X by creating/editing an environment.plist file under ~/.MacOSX. Using classing plist XML speak you describe key/string tags which become the environment variables when you log out and log in again. Here’s what I have in ~/.MacOSX/environment.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">

BTW, that tip probably just saved you 32 hours of dev time which, at your salary, is the equivalent of my stuffing over $640 in your shirt pocket… your welcome!

I got it!

I just ran the Blackberry compiler from Maven… on my Mac. Two cans of Pabst Ice and one Mike’s hard cranberry lemonade into my dev cycle and I finally see a “.cod” file show from a pyx4Me project! It’s in the wrong folder, project root vs. projectroot/target but I can live with that for now. Anyone know a groovy way to set the working directory from a command string run by the overloaded String.execute() method? I don’t wanna call out to Runtime.exec and I don’t wanna write a bunch of platform checks in my plugin. Right now I’m one too many drinks swallowed to know whether or not String.execute() implies platform. In other words I don’t know if I need to code a prefixing “cmd /c ” on my string and check for Windows before calling String.execute(). I’m not happy with the impl because there were a few things I wanted to do better. Right now I’m spawning a java process because the GMaven plugin doesn’t set the rootLoader, which means I can’t dynamically append to my classpath. I’ll either have to set the rapc.jar as a dependency or figure something else out. I’m just glad I got this far! More updates later…

Build Native Blackberry apps natively on a Mac… using Maven!

Click here for the Maven Blackberry code behind this post.

Aight, I can’t help it! I’ve been itching to get this done for sooo long. If you’re into Blackberry development then you’ll understand just how absurd the above title sounds. Let me just throw intelliJ Idea into the mix as well then you’ll begin to see the big picture. Starting to do J2ME development, an experienced Java guy like myself has naturally gravitated towards a certain set of tools. Maven2 is hands down the only acceptable build system for a Java project, while Idea beats the pants off of Eclipse, and Windows boxes…? Forget it! Java runs practically double speed on a *Nix OS plus with the flash of OS X there’s no question as to what boots on a typical knowledgeable hard working Java developer’s box. All of these tools work well, and most of them work well together. BUT… BUT!!! Doing J2ME implies Windows and Ant all around so there’s gonna be either a divorcing of the toolchain or a boatload of integration issues. This weekend I fought through the biggest of the integration issues. And this morning I finally managed to build a Blackberry .cod deployable program… completely without Windows… using a Maven2 pom… natively on my Mac! I’ve been updating my blog incrementally with all of the individual pieces so I won’t go into too much detail here. At a high level I’ll explain the tools involved.

  • One Apple Macintosh (iBook, MacPro, MacbookPro, MacAir, whatever…)
  • One Blackberry (Preferably not Verizon because I don’t think they support J2ME)
  • One Windows install (I know, but this is only to extract the Blackberry tools! You can throw the whole thing away once you got the goods out of the JDE downloads. If you have a buddy that already has the JDE just steal it from him and skip this piece all together.)
  • One install of the Blackberry Java Development Environment (JDE).
  • One bottle of scotch (or wine) for to celebrate with.
  • One install of Maven2
  • Two tablets of asprin (to handle the hangover after you’ve spent the entire rest of the day celebrating with scotch or wine.)

I think that’s everything in the ingredients list. I’ll post back later with the recipe as time allows.

Didn’t get far

I was trying to develop J2ME with Maven on my Mac and blogging about it at the same time this past weekend. As an update I didn’t get too far. Fow what it’s worth, I did get a jar to build and I was able to manually upload it to a web server and then install it on my phone. The app worked but I still need to work out the kinks in automating the deployment process. I’m not sure if my Blackberry supports bluetooth installs and if it does I can’t find any documentation on it anywhere. On my drive in this morning I got to thinking about going the rest of the way and building a Blackberry plugin for Maven, one that would execute rapc and SignatureTool. I’ll have to prototype that from the command line first. More on that later. Back to regular work for now.

Pyx4ME Hack

It’s late tonight but I gotta get this posted. I’m still trying to get a good dev cycle with the Maven Pyx4ME maven plug in and IntelliJ Idea. I’m running on Parallels on my Mac. Here’s an extra tag I added to the project generated from the pyx4ME archetype:

                  <property environment="env"/>
                  <echo message="Running WTK out of ${env.WTK_HOME}"/>
                  <taskdef resource=""/>
                  <wtkrun jadfile="target/${project.artifactId}-${project.version}-me.jad"/>
                <copy overwrite="true" file="${}/${}-me.jar" tofile="${}/site/mymidlet.jar" />
                <copy overwrite="true" file="${}/${}-me.jad" tofile="${}/site/mymidlet.jad" />
                <replace value="mymidlet.jar" token="${}-me.jar" dir="${}/site">
                  <include name="mymidlet.jad"></include>

This lets me run my project using WTK assuming WTK_HOME is been set as a system env var. More stuff later.

Idea Maven Drama

Ain’t got much time to speak on it but here’s what happening. Just upgraded to Idea 7.0.3… upgrading Idea always feels like Christmas… anyhowz…

Went thru some pain getting my Maven projects hooked up right. This was on my Mac. I have an install of Idea on four or five machines here. The one on my Mac was a little dated since I’ve been doing all this mobile dev which requires Windows. So I had to pull down my projects from Svn and do a little refreshing. Mid way through I ended up deleting and re-adding modules in my project. First surprise was the new “I’ve decided to remove all of your other projects from the Maven structure while adding this new one” dialog. I didn’t know how to respond. The dialog apparently had interest in undoing all of the work I did to create my project and asked me if I wanted to further trash my project by removing the modules from my project structure as well. I figured since it already started the delete process it would be a bad idea to keep things half done. So I was like “go ahead, delete. I’ll re-add the modules since you didn’t quite understand my intentions Mr. IDE.” Another dialog asking if I wanted to remove the VCS root of these projects as well. I knew this dialog from being bit in the past on an earlier build of Idea. Apparently if you don’t agree with this nasty dialog you’re left with a project “.ipr” that can no longer link previously deleted modules with the VCS provider they were associated with. So then I’m like, “aww crap… go ahead and completely clear my project so I can add this one module thank you.” That’s just what I wanted to do. Create a brand new project around one sily module. Well after being bossed around by those mean ol’ dialogs I eventually got everything reimported when I got another surprise.

Maven support is wonderful in Idea. So wonderfule you set your clock by it. So great you invite your friends and grandfolks over to admire and discuss its features. Of course the old-folks don’t really grok the tech talk. Hell, they don’t even grok “grok”. They’re just happy to have conversation with the grandkids and get out of the old folks home once in a while so they’ll happily listen to practically anything you mumble to them while feigning interest. That’s the nice thing about grandfolks. Just like grandfolks Maven support is nice. However, when it breaks it leaves no clue as to what went wrong. So I’m trying to import this one module and I noticed they fixed one crappy hidden problem explanation. If I don’t mount the network drive where our shared install of Maven is hosted it used to pretend that there were no maven projects in any folder. Now I get an error dialog stating that it can’t find the mapped drive or something like that. The next nasty problem starts with a pom that doesn’t define a group id. You see, I’m pulling modules in from another project I worked on a while ago with a whole new parent structure that no longer exists. So I went and removed the parent tag because I was being nagged about the parent pom not being found. I never thought about how I inherited the group id. So now Idea starts giving me nasty NullPonterExceptions after I’ve imported and thought I’d successfully set everything up. This happens everytime I synch the project. Then it happens even worse when I recreate the project from scratch trying to pull the errant module in. I just keep getting NPE and scratching holes in my scalp. I’m well over my word limit for a quick post that started with “I ain’t got time to splain much…” Hit me up people…

Hiatus, Facebook, and Maven… who loses?

Where that crazy boy been? It was like four hundred thirty nine months since the last post! Aight, maybe you’re not exactly saying that. Maybe you’re just thinking it. Maybe you’re thinking something along those terms. I’ve been heads down writing some stuff. I wrote some posts you’ll never see due to some nasty bug in wordpress software which cost me yet again two of my most magnificent pieces of writing. (When will I learn to stop hanging my life on cool techno-features like the auto save installed a while back on WP?) I’ve written some little trinkets and example apps for a lunch and learn that I’m supposed to be doing tomorrow but had to postpone and postpone again all while fighting with two user-friendly software packages Outlook and Entourage, losing the entire message body of a scheduled meeting which I thought was kinda clever. I’ve been writing some presentation slides in Keynote (the Mac clone of PowerPoint which I think is a little better than its counterpart) which I have yet to save and export as ppt files before my trial ends in days resulting in loss of two weeks worth of organizational notes and ideas. I’ve also been writing to the nice folks at codehaus regarding my about-to-expire IntelliJ Idea license which can cause me to lose local history and shelved changes from the past month. Now I’m writing about how I’m cutting all of my losses before I lose my mind. Call it hiatus, a long nap, too much time on the toilet, or whatever but I’m back.

So what’s up? I’ve been meaning to mention how I’m on Facebook now, not that anybody cares or even visits either site but I’m there. I guess you can search for me by name, Clifton Craig. My dumb picture should pop up. Speaking of Facebook, Rory’s been asking for help writing an app for Facebook. I might throw my hat in the circle and volunteer. I’d volunteer because that’s exactly what I need. One more commitment on top of GSpec, Jump, Fallframework, the three lunch and learns I’m planning at MapQuest, my promise to show Merlyn how to Groove, a planned post where I compare JMock and EasyMock (why use EasyMock when there’s JMock?), my half-baked work on my brother’s web site, an unbegun web site development for my Aunt, church, after school activities for my daughter, my recent eBay salesman venture (I raised a whopping $1.04 in revenue minus roughly $0.89 listing fees, minus the $1.04 in gas it’ll take to run to the post office, minus the 20 minutes of development time where I’m paid about $198/hr I lose for making the run nets me about -$99.89 profit!!!), and my master plan to dig myself out of debt. One more commitment would be perfect. One more big idea that will change the world if I can just do thing X.

I accept!
So yes, Mr. Rory I accept your challenge to write the ultimate Facebook app. Dare you accept my challenge of refusing C# and instead writing the thing from scratch using my upcoming release of RPG-Fusion running on a mega PC with quad dual octal core Celeron processor and 18 Peta-Bytes of RAM custom designed by my army of under-paid XSLT developers from the mid 2000’s working with flat head screwdrivers and outdated copies of Michael Kay’s reference manual? (…won’t twist a screw but can drive the living bat-crap out of a nail!) Do you Mr. Blythe? Dare you? Must you? Will you? Can you? Ha! I laugh at your inequity! I make a sound of joy at your inability to embarq on my mission! Ha-ha!! My lungs fill and empty oxygen continually and rapidly resulting in whimsical noises because your cowardliness!!

Maven for the graven
As I said earlier I was working on these two rather entertaining posts regarding Maven and alluva sudden I hit save on one and they both disappear to be replaced by an error message. Not just any error message, one of those I want to entertain you while I inform you that your work will most likely never be recovered messages. You know the kind where said developer feels good about the UI he/she has designed and wants to spice it up with comedy. Not that any of us coding nerds are ever actually funny but some of us try and the result is, well… let me just say I might have actually been amused if it was someone elses work heading of into server abyss. I might have even chuckled at the wording if I could remember it exactly. I digress. More on Maven… I mean here’s what I wanted to talk about 4-5 days ago… humor and anecdotes removed:

there’s an undocumented attribute I found in the archetype descriptor. the resource tag has a boolean “filtered” attribute that lets you turn off filtering for binary resources. Then there’s another hidden gem I found a week ago. The cargo plug-in has a properties/context element (that falls under the configuration/deployer/deployables/deployable element) that allows you to set the web-application context for your deployed archive.

See? Condensed and to the point. Not nearly as much fun as half the nonsense I post here, never-the-less informative. Man, I felt like I was on a roll that day! I had a big ol’ explanation about writing code on a MacPro in the middle of the mall in the kiddie play area using public wifi and expecting performance comparable to what I get at home while random off-spring whiz back and forth at the speed of play (which is roughly between 45-69 foot steps per second) coming within centimeters of the LCD screen which I desperately tried to keep out of the line of traffic.

Wow! Look at the clock! I mean if you could look at the clock.. err it would probably say something more reasonable than what mine says right now because you’re like, in another part of the planet reading at a very different time than I am so looking at the clock doesn’t make much sense to you. It doesn’t make sense to me either because my clock says it’s waaaay past my bed time, literally. I have an analog clock without numbers. Instead it has words marking important relevant events, wakey-time, worky-time, feedme-time, potty-time, party-time, miller-time, and bedtime. Right now the little hand is like really past the bedtime mark telling me that I spent too much time filling this unvisited site with garbage when I should’ve been writing the next award winning software the likes of which mankind will never see because instead of writing said application I’m wasting more time bragging about my ability to writing techno-extravaganza and then going off on a recursive tangent describing how said extravaganza will never release because of an analog clock which doesn’t actually exist but is supposed to have clever markings like potty time and party time and doesn’t have anything to do with the Facebook app that The Sandwhich Hunter is afraid to co-author with me because of random air expulsions vibrating my vocal chords filling the room with comical noises that attempt to intimidate Mr. Poleon into submitting to my superior coding ideas for his inferior Facebook idea. Yeah, it’s getting late… Holla back if ya’ feelin’ me…