Apache Netbeans - compilazione e aggiornamento

Con il passaggio di NetBeans alla Apache Foundation si è, per ora, persa la possibilità di scaricare versioni specifiche e già preconfezionate di questo IDE. Se si unisce questo all'attuale impossibilità di usare la versione 9 del software, come offerta preconfezionata dalla Apache Foundation, anche per lo sviluppo PHP emerge come si debba trovare un metodo alternativo per ottenere, con poco sforzo, un tool di sviluppo aggiornato e adatto ai propri scopi.

Per questo motivo vi propongo lo script che sto usando per compilare Apache NetBeans all'ultima versione disponibile sul relativo reporistory GitHub e con il supporto a tutti i linguaggi previsti (PHP incluso).

Copiate quanto segue in un file (es: ~/build-netbeans.sh), date a questo file i permessi di esecuzione, modificate SRCDIR e DESTDIR con i path assoluti alle directory che volete usare, eseguite lo script appena creato e .... avrete il vostro Apache Netbeans pronto per l'uso!

Attenzione: La compilazione, oltre a vari tool, richiede che abbiate installato JDK o OpenJDK.

#!/bin/sh# where to store Apache Netbeans sources , don't add trailing /SRCDIR="/usr/src/netbeans"# where to install Apache Netbeans binaries , don't add trailing /DESTDIR="/home/user/netbeans"# set to 1 to preserve last Apache Netbeans binary installationDOBACKUP=1ANT=$(which ant)GIT=$(which git)if [ "$ANT" = "" ]; then	echo "ANT not found, install ANT 1.9+"	exit 1fiif [ "$GIT" = "" ]; then	echo "GIT not found"	exit 1fiif [ ! -e $SRCDIR ]; then	mkdir -p $SRCDIR 2>/dev/null >/dev/null	if [ ! -e $SRCDIR ]; then		echo "Unable to create $SRCDIR"		exit 1	fificd $SRCDIR[ ! -e incubator-netbeans ] && $GIT clone https://github.com/apache/incubator-netbeans.git[ -e buildok ] && rm buildokcd incubator-netbeans && \git pull && \LANG=en $ANT -Dcluster.config=full && \touch ../buildokif [ ! -e ../buildok ]; then	echo "Unable to build Apache Netbeans"	exit 1fiif [ -e $DESTDIR ]; then	if [ "$DOBACKUP" = "1" ]; then		BACKUPDIR=${DESTDIR}-$(date +%s)		mv $DESTDIR $BACKUPDIR		if [ "$?" != "0" ]; then			echo "Unable to create backup in $BACKUPDIR"			exit 1		fi	else		rm -rf $DESTDIR		if [ "$?" != "0" ]; then			echo "Uname to remove old installation in $DESTDIR"			exit 1		fi	fi	mkdir $DESTDIR	if [ "$?" != "0" ]; then	    echo "Unable to create $DESTDIR"	    exit 1	fielse    mkdir $DESTDIR    if [ "$?" != "0" ]; then	echo "Unable to create $DESTDIR"	exit 1    fificd nbbuild/netbeans && \cp -prf * $DESTDIR/ && \echo "bin/netbeans" > $DESTDIR/netbeans && \chmod +x ~/netbeans/netbeansif [ ! -x $DESTDIR/netbeans ]; then	echo "Unable to finalize installation in $DESTDIR"	exit 1fiecho "Installation complete"echo "Now you can launch Netbeans using $DESTDIR/netbeans"echo ""exit 0