Monday, December 31, 2012

Eclipse behind proxy

If you are using Eclipse behind a proxy you will sometimes notice, that your network connection will fail although you have filled out your proxy settings correctly.
Especially when using the update center to install new software.
 Eclipse will try to establish the network connection but without any success.

But there is a simple solution for the problem. Just edit your eclipse.ini file (could be foound in the eclipse installation root directory) and append the following line:

-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient

Restart eclipse and you will be happy ;-)

Thursday, August 2, 2012

Netbeans and maven: create custom goal

It's very easy to create and store a custom maven goal inside the Netbeans IDE for your projects. Maybe you want to have a goal for clean build but skip test's

  • Just right-click on the module you want to create the goal for and choose Properties
  • Navigate to the Actions tab and press Add custom...
  • Enter a name for your goal - e.g. clean build no tests
  • In Execute goals you can enter the maven-goals you want to execute: clean install
  • adding properties is quite simple: press Add -> and choose the one you need
  • you can also just input the properties you need in the textarea
This custom-action will be stored in the nbactions.xml of the corresponding module:

        
            CUSTOM-clean build no tests
            clean build no tests
            
                clean
                install
            
            
                true
            
        

Friday, July 27, 2012

Netbeans and maven: no single test execution

If you are using Netbeans in a maven build environment and got the problem that you cann't execute a single test you've probably specified the surefire 2.12 plugin... that's a bad idea :-)

Netbeans will prompt a:

No tests executed (0, 0)

The reason is, that this version of the surefire-plugin (2.12) has a bug and it's not possible to execute single tests or even single test-files.

See Surefire 2.12 cannot run a single test - JIRA for more information about the status of this bug.

The solution:
Quite simple - go back to surefire 2.11 :-)


        
          org.apache.maven.plugins
          maven-surefire-plugin
          2.11
        

Thursday, July 19, 2012

Netbeans Plugin: Copy and Paste History - quick review

The Copy and Paste Histroy - Plugin for Netbeans is imho a small but very very usefull extension you should install to the Netbeans IDE.
There is just one Key-Feature:  

Enable more than one entry to CopyNPaste

But that's a killer-feature in some cases ;-)

By pressing ALT-V instead of CTRL-V you will get a list of the last history-entries you have copied. Just choose the right one and press ENTER - and that's all.
Just have a look:

Wednesday, June 27, 2012

NetBeans Platform customize app.conf in maven build

This short tutorial describes how to customize the app.conf file of a NetBeans Platform based application in the maven build environment.

Every application developed on top of the NetBeans Platform has a file called app.conf
You will find this file in the generated target folder: app/etc

This file describes some startup and runtime parameter of your NetBeans Platform based application.
Here is a simple example how the generated standard app.conf file could look like:

# ${HOME} will be replaced by user home directory according to platform src/main
default_userdir="${HOME}/.${APPNAME}"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding platonframework -J-Xms24m -J-Xmx256m"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea

# default location of JDK/JRE
#jdkhome="/path/to/jdk"

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=
By edditing this file you could for example specify a new jdkhome or start the application with more ore less memory. But when you build your application next time all changes will get lost because the NetBeans Platform build system will update this file too and override it with the default values...

But how to customize this file and tell the build-system not to use the defaults?

The easiest way to customize the file is to copy the current content to a new file called e.g. customized.conf - within this file you can change everything you want to. Then you have to tell the nbm-maven-plugin to use your customized.conf file. Just declare the following in the pom of your app-Module inside the build section:

  
    org.codehaus.mojo
    nbm-maven-plugin     
    true
    
      PATH/TO/customized.conf 
    
  
The nbm-maven-plugin will use your file as copy template when building the application. At the end it will still be called app.conf - but with your custom code inside ;-) Very easy but sometimes hard to google that out...

Tuesday, June 26, 2012

Enable Oracle-Featues in HSQLDB

If you are using HSQLDB for rapid development there is an easy way to enable Oracle-specific features like:
  • DUAL 
  • ROWNUM 
  • NEXTVAL 
  • CURRVAL 
  • ... 
 Just set the Property sql.syntax_ora to true or false (if you would like to disable)
SET DATABASE SQL SYNTAX ORA { TRUE | FALSE }

Without this property you will get a:
java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: DUAL
when executing for example:

SELECT SYSDATE FROM DUAL;

Defining this property in your persistence.xml your javax.persistence.jdbc.url could look like this:

There are of course properties to enable some other vendor-specific database featues for:
  • DB2: sql.syntax_db2 
  • MySQL: sql.syntax_mys
  • MS SQL: sql.syntax_mss 
  • PostgreSQL: sql.syntax_pgs