I’ve been playing around with different build tools for my Java projects recently, having never been very happy with Maven. Probably the best that I’ve found is Gradle: it has an easy to use build file format, and seems pretty flexible if you need to do something a little differently.
Unfortunately the documentation isn’t as comprehensive as it could be, and one of the areas where it’s not too great is in it’s interaction with the Maven repository system. So, here’s the magic incantation that you have to add to your build file in order to have gradle install install things correctly to your local repository:
12345678910111213141516
applyplugin'maven'configure(install.repositories.mavenInstaller){pom.project{groupId'com.example'artifactId'project-name'inceptionYear'2011'packaging'jar'licenses{license{name'Eclipse Public License (Version 1.0)'url'http://www.eclipse.org/legal/epl-v10.html'distribution'repo'}}}}
this will install the project binaries, to also install source and JavaDocs (which every project should really do) then you’ll also need to add:
When I’m writing technical docs in MS Word (an unfortunate day-job-related requirement) one of the things that can be annoying it the fact that it ‘helpfully’ converts straight quotes into curly quotes, even in code samples and other places that it shouldn’t. The easy way to get rid of this is to hit undo (⌘-z) immediately after typing the quote, this will undo the auto-correction but leave the actual quote character in place.
> I could end the deficit in 5 minutes. You just pass a law that says that anytime there is a deficit of more than 3% of GDP all sitting members of congress are ineligible for reelection.
He’s talking about the US Congress, but it would work here as well.
The problem with this, as Mr. Fowler points out, is that it can lead to problems with the implementation. His preferred solution is to have a private implementation method exactly like the original problematic API:
But if we think about the problem for a little longer we can see that there is a better option available to us. The real problem with flag arguments is that they lose information at the call site, so the original example method would be called like this:
There’s nothing to say what those true and false arguments actually mean. We can just define a type-safe enum to use instead of the boolean, that way the information is still present at the call site. This was our API becomes:
It seems that the New York Post have decided to block all access to their site from iPads, telling users to download their (subscription only) app instead. As Scripting News said…
I wonder how Apple feels about this? I can’t imagine they like it. I can see the ads now. ‘Get an Android tablet to read the web.’ Hmmm… I wonder how long said app will remain in the store after pulling a trick like this?
This quote has been doing the rounds lately, at least I’ve seen it on two or three different blogs, most recently here…
> Debugging is twice as hard as writing the code in the first place. > Therefore, if you write the code as cleverly as possible, you are, by > definition, not smart enough to debug it.