Two Issues I have With IntelliJ: Inconsistent building, and GUIs

During the massive end-of-days sale, I bought a copy of IntelliJ. I have been primarily a NetBeans developer, but I have used IntelliJ at a previous job. So two of the things that irritated me have been: the inconsistent build support and IntelliJ’s handling of Java GUIs.

IntelliJ has its own internal build system. However, it also has support for Maven. When you have a Maven project, it adds in dependencies to the Maven file, but continues to build with its internal build manager. If you need to add a dependency, IntelliJ will automatically add the dependency in the POM file, but you have to manually add it in its own build manager. Given this inconsistency, it is possible to have two different build configurations within the same project.

Additionally, converting a project from a Netbeans based project with a GUI doesn’t work in IntelliJ. IntelliJ will not interpret the Swing code generated by Netbeans. This means that for anything GUI related, I will have to use Netbeans.

What would be nice?

Support a non-proprietary build system. NetBeans defaults to ANT, and can support Maven natively. If this is not an option, then write an adapter for Maven/ANT/Gradle.

GUI: Reuse the Mattese code. Make Mattise a plugin and write an adaptor for IntelliJ.

Links I’ve Found Interesting in the Last Week/Technical Things I’ve found Interesting (6 January 2013)

  • Getting the “Application Server Libraries not found” error with IntelliJ when you try to add a local Tomcat server? If you’re using Gentoo it’s a matter of file locations. Install the tomcat-api package, and make a symbolic link from the API within the Common and Shared Tomcat directories. Source.
  • Tomcat 7 has changed around how resources can be accessed. You can no longer use “getResourceAsStream” to get files placed in the Web-inf/Classes folder. Instead, you should attempt to get the resource through the context of the local thread. An example: Thread.currentThread().getContextClassLoader().getResourceAsStream(). This is useful for applications that use JasperReports [location of the JRXML file], and that are web applications. Source.
  •  If you are trying to stand up a web server, and don’t want to allow it to accept public connections? Set the accepted connections on tomcat to only listen on the local address. For tomcat see this. For NGinx see and set it only set listen to 127.0.0.1:[port].
  • Converting a GUI Netbeans project into a Maven based project? Most of the needed libraries will be covered by the default Maven repositories. However the swing-layout dependency is a special case. To use include the Netbeans repository reference, and include the swing-layout-1.0,4 dependency.
    Repository:

    <repositories> 
       <repository>
          <id>netbeans</id>
          <name>NetBeans</name>
          <url>http://bits.netbeans.org/maven2/</url>
       </repository>
    </repositories>

    Dependency:

    <dependency>
       <groupId>org.netbeans.external</groupId>
       <artifactId>swing-layout-1.0.4</artifactId>
       <version>RELEASE691</version>
    </dependency>
  • Ignoring failed tests on a maven build: Add this parameter to your mvn command: -Dmaven.test.skip=true
  • Sort directories and files with a human readable format: This is like ls –Sh, but it traverses directories.
  • If you have a set of directories to ignore, SVN propset includes an option to recursively ignore specified names/folders. A word of warning propset overwrites any svn:ignore properties.