Checking out Hibernate with STS

I have cause to revisit my post about importing a git checkout into Eclipse. I need to take a look at the Hibernate code, which is on github at git://, and given the somewhat convoluted nature of this code, I need an IDE to help navigate it.

Now, I hear that with Eclipse Indigo (3.7), which is included with the latest STS 2.9 (which is what I use), the EGit plugin is included out of the box (which, for the purposes of this post, is what I’m doing – completely stock install). That’s helpful. See, previously, if you wanted to do something with git, you would find no evidence within Eclipse that it could. If you figured “there must be an extension for that” and searched for “git” from the extensions wizard, there would be no hits. Because what you needed to look for was “JGit” or “EGit” – you big dummy. An example of what I consider low discoverability that’s pervasive in Eclipse/STS. But I digress.

At least EGit has had a couple years to bake since my post. I went to File->Import->Git->Projects from Git and put in the URI above. This seems pretty straightforward:


I’m not sure why it parses the URI into Host and Repository path here. Is there some reason you’d want to customize these?

In the next step, I pick the branches from the repo I want and proceed to the “local destination” dialog.


These steps might be somewhat confusing to those who don’t know git and just want to take a look at some code. Since git is distributed, you don’t just get a point-in-time checkout from a repo, you get your own copy of the repo – or as much of it as you want. Basically it’s asking where I want my copy of the repository and checkout to go. The checkout (“initial branch” here) will go in the directory, and the repo will go in a .git subdirectory. “origin” is the name given to the repository I cloned this from, in case I want to sync with that later. That might be kind of obvious to someone familiar with git, but how about some tips for those who aren’t?

My question: why doesn’t this all simply default to being inside the workspace? What’s a workspace for, if not the project contents? As you can see, the default is to create a ~/git directory and checkout/clone the repo there.

Next step, three inscrutable options for how to deal with the resulting project(s) that have been checked out:


OK. These seriously need some explanation. What do these do?

“Import existing projects” gets me nowhere in this case, as it requires Eclipse project descriptors to be included in the checkout, and they’re not. Arguably, they probably shouldn’t be. I just get the error “no projects found” if I try this. But that means I need to figure out myself how to get Eclipse/STS to interpret this checkout properly.

“Use the New Project wizard” is an option I don’t really understand. It just dumps you into the new project wizard you would get by clicking the new project button (generally the first button in the toolbar). This is also where you end up if you click “Finish” instead of “Next” anywhere along the way. I guess I could make use of the directory just created. I  also can’t go “back” and choose another option from here; cancel, and I’m back to square one. In general, I find the “New Project wizard” one of the most confusing things about Eclipse/STS, because there are so many options, many sounding similar yet meaning something completely different, and no explanations of what you can expect to get. Do I really have to go looking for doc that should be a click away? I digress.

“Import as general project” basically just creates a project with the given content and no organization. STS recognizes the different file types, of course, but there’s no concept of where the classpaths begin, how to build and test the project, anything like that – just plain directories with content. This won’t get me to my goal, which is to be able to look up class hierarchies, implementors of interfaces, etc. However, having done this, I can try to configure the project to get it to where STS understands these things.

I’m interested in the 3.6 branch of Hibernate, which is a Maven project (you can tell from the pom.xml – woe betide you in the Java world if you don’t recognize Maven when you see it. The “master” branch seems to be using Gradle). So I can right-click the project and Configure -> Convert to Maven Project.

By the way, let me point out something that didn’t work at all: creating a new project with the wizard “Maven -> Checkout Maven Projects from SCM”.


This is apparently not aware of the EGit plugin, because there’s no SCM protocol listed here (the first box  is greyed out). If I click “Finish” here nothing happens except the dialog exits. I think it would probably work if I added a m2e SCM connector like the link suggests, but how would I know to do that?

Alright, so now I have a Maven project. Right away in the top-level pom.xml I get a “Project build error: Unresolveable build extension: Plugin org.jboss.maven.plugins:maven-jdocbook-style-plugin:2.0.0 or one of its dependencies could not be resolved: Could not find artifact org.jboss.maven.plugins:maven-jdocbook-style-plugin:jar:2.0.0 in central (”. I happen to know what this is about because I know there are a bunch of JBoss dependencies not in Maven Central. How would I know that if I didn’t know? Google, I guess. Fortunately searching for that exact error message gets me right to a StackOverflow question about exactly the same thing, which someone has helpfully solved. I love SO, I just hate that it has to exist. Documentation is always about how to use something the right way, not what to do when something goes wrong. SO fills that gap.

So, add the repository information to the pom.xml – or, better, to my Maven settings.xml (which I had to create since STS is providing Maven in this setup) and on to the next problem. Two, actually (always seems to be the way of it – removing a build problem just uncovers more). These are related to “Missing artifact commons-logging”. A little Google sauce on that turns up this blog post (like the name, kinda like my blog!) about the death of the commons-logging dependency. Gotta love trying to support these old builds from a public ever-changing repo. Problem is, the Hibernate pom (actually the parent pom, which is in a subdirectory! huh?) uses the hack from that article, but the repo supplying the dummy dependencies seems to be down. So perhaps I should try the exclusions suggested by commentors in that blog? I found something that looks handy: in the pom dependency hierarchy, right-click and choose “Exclude Maven artifact”:


Sadly, this doesn’t work:


But here’s another StackOverflow suggestion. This seems to work, after removing the existing commons-logging dependencies and adding those ones in the parent pom, and (finally) right-clicking on the project, Maven -> Update project configuration. The errors are gone, and (I suspect) so is all the Maven-fu I can expect today.

Unfortunately I’m still not at my goal – I just have the Maven nature working now.

Turns out, this wasn’t quite the right path. What I’m looking at here are multiple Maven projects, with interdependencies. There’s no way I’m ever going to get anything useful from this in a single STS project. What I need to do is import these as multiple projects. In the meantime, delete the existing project (but leave the checkout) so it doesn’t get in the way.

So here’s what I do: File -> Import -> Existing Maven Projects and enter the path to my local checkout as the “Root Directory”:

If I select all the projects, they’ll all be created as interdependent workspace projects, each with build path and so forth configured according to Maven.

With lots of errors, of course… thousands, in fact. But let me start with the Maven problems, which are probably the source of the rest. Looks like all of the Maven errors are of the form “Plugin execution not covered by lifecycle configuration: org.jboss.maven.plugins:maven-injection-plugin:1.0.2:bytecode (execution: default, phase: compile)” – with a different plugin each time. I remember the import screen warned about some problems that would need to be resolved later – this seems to be what it was talking about.

Well, much later now, I think the Maven errors were mostly irrelevant. Those were due to the change to the m2eclipse plugin which broke the world for a lot of Maven users in Eclipse. Most of them were things that looked like it was safe to have m2eclipse “ignore” as recommended there. I went ahead and ran some of the goals that looked important (antrun:run and injection:bytecode in hibernate-entitymanager, the latter in hibernate-core) from the command line. Not sure they made much difference. I did Maven -> Update Project Configuration on everything changed and most of the red X’s went away.

I also ran into this problem and crashed a few times just by mousing over the “Window->Browser” menu before adding “-Dorg.eclipse.swt.browser.DefaultType=mozilla” to my STS.ini to avoid it.

At this point, the only problem seems to be that hibernate-entity has a ton of tests with imports like this:

import org.hibernate.ejb.metamodel.Customer_;
import org.hibernate.ejb.metamodel.Order;
import org.hibernate.ejb.metamodel.Order_;

… and then goes on to use these classes with underscores, which aren’t there. Evidently they’re supposed to be generated at some point, but I’m not sure how. I don’t really care about running these tests, just wanted to look at the framework code, so although STS reports 14382 Java problems, I can consider my work done here. Boy, that was easy!

One more note: I went back and added the git SCM connector for m2eclipse to try it out. It worked… but poorly. The way that worked was to select “git” for the scheme, then put in the git:// URI for the project, then wait for a popup to select the projects to import. If I reversed order or didn’t wait, I got either an error or nothing after hitting “Finish”. Hmm… hope that’s better in the next update. And, interestingly… the checkout/repo went into the workspace.

Hating “The Walking Dead”

I made the mistake of watching the first episode of “The Walking Dead” yesterday. I don’t like zombie movies or horror in general, so it’s no surprise that I didn’t enjoy watching it. I just wanted to see what made this thing so popular. Don’t get me wrong, I can see this show seems to be done reasonably well, for the genre – with an eye to keeping it convincing and interesting.  But aside from it being disturbing (I don’t enjoy the adrenaline rush, that’s why I don’t like horror), I was kept awake this morning just thinking about the huge plot holes.

It starts right up front. Our hero is looking for gas or something and comes upon the remains of a bunch of abandoned cars and a camp. There’s a little girl shuffling around, picking up a doll. This guy knows the zombie apocalypse has happened, but calls out to this little girl as if there’s really some chance she’s survived, unlike the rest of the camp, without becoming a zombie. Then he shoots her when she turns around and heads his way. Was this even necessary to set the tone? We all knew this is a zombie flick.

Or how about the way Hero gets injured? (I know, his name is apparently Rick, but I’m not sure we even find that out in the first episode – no one ever introduces themselves. How is that possible?) The bad guys run across the tire killers, their car skids and rolls over several times, then they come out shooting? I’m sure those guys were wearing their seatbelts and didn’t get crushed by any car pieces, were able to locate their guns, and thought they could win in a shootout with four cars full of police. While standing up with no cover. I know criminals tend to be dumb, but even if they miraculously had the ability to get out of the car and shoot, that’s just suicidal. If they wanted to die, they could have shot themselves.

So Hero wakes up in the hospital, evidently from a coma, weak and dehydrated. He must have been there for several days after the battle in the hospital, and even if the IV was keeping him full of fluid, that wouldn’t have lasted for a day after. And he should probably be sitting in urine and feces too. Not to mention dead, because who gets better from a gunshot wound while unconscious and totally neglected? Fortunately the water still works – that much at least is plausible. Fortunately he doesn’t need any food in order to stumble out of the place and make it home. And fortunately the only zombies he sees are locked behind a door or nearly immobile (what luck! I thought the point of zombies is that they show up everywhere).

Now at this point, I know he’s disoriented and dazed. But he can’t be completely daft. He had enough sense to get away from the zombie fingers behind the door reading “Don’t Open Dead Inside”. He had to have figured something Really Bad happened at the hospital when he saw the pools of blood, the military stuff, and the body bags. He saw the half-person zombie in the park trying to pull itself along. Anyone who has ever heard the word “zombie” (which is all of us, but apparently nobody in this show since they’re just called “walkers”) knows what happened. But he just heads along home, and doesn’t even search for a weapon? Even just a stick or something? He’s a cop, he must have at least had a piece hidden away somewhere at home – nothing? And then he’s surprised when Savior and Son come along, bean him upside the head, and shoot a zombie headed towards him?

Now Savior is a real enigma. He sure seems to know a lot about zombies. He knows how a person becomes one – getting bitten or scratched, then dying after a hot fever. He knows it’s something in the brain that makes them a zombie, and you can kill them with a headshot. He knows they’re a force to be reckoned with when they’re a hungry crowd. There have to be some stories behind this. But he never lets the new guy in on how he knows any of this (experience? other survivors? a radio/TV broadcast?). It’s obvious his wife became a zombie, but that’s not enough to have learned all that.

And how did he learn this and survive, while apparently the military didn’t? Because what kind of idiot gets out of the tank or chopper so that the zombies can get them? They must have had at least a few days to figure out what was going on and mobilize. What kind of idiot military guy lets his buddy die from a zombie bite and high fever and then doesn’t put a bullet in his head when he knows the guy will come back a zombie? How hard can it seriously be to just stay in the tank/truck/chopper/etc. and pick off the zombies outside? It’s not like it’s hard to tell them apart. And zombies don’t operate weapons or machinery, or coordinate or have any ability to do anything clever, so why all the destruction? But all of this is just left to our imagination – we just see the aftermath. Maybe we’ll learn more in later episodes, but sorry, one episode is all I can take.

The reason all this was done is just to heighten the tension. And I hate when implausible things are filmed just for that reason. It’s so phony.

Let’s continue. Everyone was advised to evacuate for Atlanta. Hero and Savior haven’t thought of the possibility that the zombies might come along? Well, if not, then surely when Hero got to the ourskirts of Atlanta and saw all the cars broken down headed the other way, that might have been a clue. But Hero just rides in on a horse, apparently in condition white, as if what happened to all those other people couldn’t happen to him. He can’t seriously be that stupid or conceited. It’s just a plot device. Also, how can he sling all that equipment and ride a horse a day or two after barely walking out of the hospital? He’s right as rain that quickly?

Also, he makes a radio call-out, but never identifies himself. Surely even if it was just force of habit he would have done that. But he doesn’t, because that way the group of survivors including his wife can’t find out he’s still alive. Plot device. Good one, but still phony.

So, Hero gets to Atlanta, and runs into a horde of zombies. How is it possible that they take down his horse and are already into its innards while he has a chance to scramble away? Do you know how strong a horse is? The guy didn’t stand a chance. Even if they were distracted by the horse, it’s impossible with so many zombies that he didn’t get a scratch or a bite.

One more thing. We saw a little girl zombie at the very start. So we know kid zombies are possible. Where are they the rest of the episode? Where are the toddler and infant zombies? Yeah, I know, couldn’t fit them in budget, or child labor laws, or whatever. I’m kind of thankful, though, because the last thing I need is nightmares about my little girl becoming a zombie.

I have to admit, the first episode was gripping enough that I’m really curious what’s going to happen next. But not enough to endure the show.

Please Steal This Idea: enhanced phone trees for smartphones

Calling for support really sucks. It sucks more some places than others, but it sucks everywhere. And guess what… it sucks for both sides of the conversation!

I think it’s preposterous, now that I have a smartphone with a touchscreen, to say nothing of Skype and other VoIP solutions, to have to listen to a serial voice tree of options. “Wait, was number 3 what I wanted? Maybe it was 5, what was that again? Oh crap… nothing on this menu sounds like what I want…” And thus do we fail to connect to the right place, frustrating both the caller and the eventual recipient.

With a video display attached to the phone, the least we could do is present the options in parallel on that screen. Shouldn’t take too much bandwidth to send this as a blip at the beginning of every menu; each phone client would require some kind of application or hook that intercepts the blip, displays the menu (which the user can scan back and forth as needed), and turns the user selection back into a phone signal. And if the user isn’t calling with an enhanced client… fine, they’re stuck with the traditional voice reading.

Better yet, the entire tree of potential choices could be communicated at the beginning of the call, the user could walk it at their leisure to find the path that seems optimal for them (perhaps with projected answer times at each end node), and then skip right to the end node where they’ll be connected. And that tree and preferred choice could be cached for the next call, where it would be compared to the tree at that time (avoiding the “our menu has changed” sentence that always makes me wonder “since when?”) and usually re-used.

That would make for a lot “smarter” phone.

If someone isn’t already working to bolt this on to the existing phone system, I hope it’s because they’re targeting something like this in the next phone technologies, which won’t be analog. Maybe there, we’ll have a nice multimedia intro when calling, not just voice or text. You could even have little games to play, or information to start filling out, forums to check, etc. while waiting. To turn this inside out, perhaps in the future, contacting support will begin with the support website and only get to the audio/video call once it has been determined who you are and what you want, and the person taking your case is available to talk to – in the meantime you’re not sitting there listening to hold music, you’re potentially making progress toward your solution on your own, or at least amusing yourself.