[ mkleint ] 10:26, Friday, 25 April 2008

When updating the mojo.codehaus.org svn repository, I noticed there's a new maven plugin in the sandbox with a cool name: "IANAL Maven Plugin" . I've opened the project in NetBeans to see what the plugin does. However the plugin seems to be written in Groovy, not Java. So I installed the latest Groovy support in NetBeans from the update center. To get the right editor colorings and everything. And also to figure if it works with Maven based projects. It worked. Sort of. I got a few red underlines meaning the classpath was not right. An email exchange with the Groovy support devs confirmed my own thoughts that the problem is in the fact that groovy sources are in src/main/groovy folder in Maven projects and this folder is missing on project's sourcepath. So I added it.
The results is here . No red lines in the editor, ready for coding. There's still room for improvement though. Ideally the Groovy sources would appear in a separate Source node under the project's node. Please note that it will only work in the upcoming 3.1 version of Maven support. Coming soon.

[ mkleint ] 09:54, Friday, 18 April 2008

I've just finished installing the new Powerpack of Mandriva 2008.1 Spring linux distribution. When I browsed the available software I discovered this little gem.

I couldn't resist installing it even though it's only 6.0 and as a NetBeans IDE developer I'm using the latest daily builds mostly. For my daily work as least, sometimes I need to test on older versions though.

Maven also comes prepackaged but it was even older. 2.0.4 I think, I'll rather stick to the latest 2.0.9 release.

[ mkleint ] 19:41, Tuesday, 8 April 2008

It's great to see that many public Maven2 remote repositories are providing the index of the repository now. I've just figured Terracotta.org has used the the Nexus command line tool to create such index. Of course I have my own selfish reasons to be happy about it.

The 3.1 (coming soon) version of Maven integration for NetBeans is using these indexes to greatly enhance the user experience within the IDE. Let's preview some of the places that benefit from the indexing data.

First we need to add the Terracotta.org repository to the list of known repositories.

That's done in the Maven Repositories top level window. You can open it from Windows menu.

To verify we added the correct thing, let's expand the root node of the new repository and see what content we have there.

You can easily drill down from groupIds to artifactIds to versions. There you can immediately add the artifact to your projects or (if the metadata is present) view project website, file a bug or checkout the sources.

Browsing is cool but it gets boring after a while. The true integration puts the metadata from the index right at your fingertips when you need it.

For example when creating a new project from archetype

or in the editor for your poject's POM file when you need to check what dependencies or maven plugins are available and in what versions.

The new 3.1 version of Mevenide is not 100% ready for release, however if you want to test drive the beta quality code, it's fairly easy to setup. Download the latest NBM binaries from the NetBeans.org continuous integration machine and install them through the Tools/Plugins dialog. And while you are in testing mode, you should check it in the NetBeans 6.1 Beta build

Enjoy

Milos

[ mkleint ] 08:36, Monday, 31 March 2008

It's a good practice to have your code internationalized. The coding pattern for doing so in NetBeans modules is following:

org.openide.util.NbBundle.getMessage(FindResultsPanel.class, "FindResultsPanel.btnModify.text")

Here the FindResultsPanel is the class where the text is used, The Bundle.properties file resides in the same package as the class and the getMessage method makes sure it loads properly in an efficient manner. If you are coding a NetBeans module, you should avoid calling java.util.ResourceBundle directly.

However it's been always a pain to edit the text. First you ned to find the I18N token, then find and open the relevant Bundle.properties file and then find the line with the I18N token. The pain has become unbearable for me and I created a simple module that's capable of "hyperlinking" to the correct location in the correct resource bundle file directly from the java source file.

The hyperlink is invoked by pressing Ctrl while pointing to the I18N string. If you wait a bit, a tooltip shows with the actual message text from bundle file.

The module NBM file can be downloaded from here.
Works in Netbeans module projects only (both Ant and Maven based)
It will eventually make it either into the Maven support or the NetBeans module development modules

Enjoy.

[ mkleint ] 20:41, Monday, 26 November 2007

Eric Hartmann of the Mevenide team announced yesterday that a new version of Maven 1.1 support in NetBeans was just released. This is a maintainance release that allows people to migrate from NetBeans 5.5 to 6.0 if they still work with Maven 1.x. Of course everyone can use both Maven 1.x and Maven 2.x support (that's the one available on the default Update Center) at the same time.

Good job, Eric!

[ mkleint ] 20:27, Wednesday, 5 September 2007

Got any idea for a new feature today that sounds cool and useful now but I'm not sure if it's really so, please advise.

A bit of background:
The upcoming NetBeans 6.0 has file templates based on FreeMarker template engine. Most templates include license header. Each project can specify the license it's using and new files created in that project include the correct license then. For Apache Ant based projects, the magic property is "project.license=foo" in nbproject/project.properties file where "foo" is the name of the license template in Tools/Templates dialog.
For Maven projects I'm looking for "netbeans.hint.license" property in the pom.xml file. As a nifty easter egg, if you happen to be using Apache 2.0 license and have the "licences.license.url" xml element filled in correctly with "http://www.apache.org/licenses/LICENSE-2.0.txt" value you get the correct header automatically. (Note: If you are using some other OSS license and want that feature as well, send me the url and header content and I'll add it to the list of licenses that ship with Maven support)

Now we are getting close to my today's idea. The Apache license header includes the copyright notice, eg. Copyright [yyyy] [name of copyright owner]. Right now the name of copyright owner is replaced by the username in the resulting new file, however it would be nice if one could specify something more fancy. Like ${pom.organization.name} which would extract the data directly from the pom. With this syntax the Maven project type could make the whole POM available for new file templating. But I'm wondering if that's actually useful. What part of the POM can be used for templating? Please comment.

[ mkleint ] 20:04, Wednesday, 29 August 2007

I've fallen in love in Ohloh. Not only makes it a cool " coding experience" bullet in your resume, but also gives you interesting information about projects. Like the most active contributors, individual file licenses or people with similar software stacks to yours.

Just lately I've found out a new, cool feature was added. You can compare projects in terms of codebase. Obviously it doesn't make sense for any 2 random projects but sometimes it reveals interesting information. Like this Ant vs. Maven2 duel.
It shows (at least to me, please comment) that each tool is in different phase of development. In terms of codebase, activity and number of contributors as well. I'm not sure if the 200+ vs.140+ stack counts reflect a real world usage share though. We'll probably see more reliable results once the number of people joining the site grows.
Too bad one cannot compare Netbeans and Eclipse codebase the same way. The different philosophy behind the projects is reflected even here at ohloh. While NetBeans has one entry, Eclipse is split into many ohloh project definitions.

[ mkleint ] 08:47, Thursday, 19 July 2007

I've been asked many times about using Maven dependency management within NetBeans' ant projects. I've usually just simply pointed to the Maven Ant tasks page. As a result of recent email conversation I had, I've actually tried to setup a sample project myself.
With help of this NetBeans wiki page on Ivy it turned out to be fairly simple indeed. And while I was at it, I've added a new FAQ page to NetBeans wiki. It's a step-by-step tutorial with sample project attached. Enjoy!