Maven dependency for org.netbeans.* (AbsoluteLayout) in a Swing application

December 11, 2011

Just a quick post about how to resolve dependency errors in Netbeans when setting up Maven for a Swing application. I struggled to find any information on which repositories to use so thought I would post in case other people had the same issues as me.

If you create a Maven project and add existing Swing .java files then you may find errors such as:

Error package org.netbeans.lib.awtextra does not exist ...

This package resides in the AbsoluteLayout.jar that is normally automatically supplied by Netbeans. In order to add this dependency to your Maven pom.xml you need to add the following lines:

<repositories>
  <!--These are needed for Swing/Netbeans -->
  <repository>
    <id>maven2-repository.netbeans.maven2</id>
    <name>Netbeans Maven Repository</name>
    <url>http://bits.netbeans.org/maven2/</url>
    <layout>default</layout>
  </repository> 
</repositories>

This should be added somewhere above the opening tag.
Then add:

<dependency>
      <groupId>org.netbeans.external</groupId>
      <artifactId>AbsoluteLayout</artifactId>
      <version>RELEASE701</version>
</dependency>

You can check for the latest version of AbsoluteLayout.jar here.

One Response to “Maven dependency for org.netbeans.* (AbsoluteLayout) in a Swing application”

Leave a Reply