Skip to content

Git, Maven and Netbeans Tips

fgsms edited this page Nov 10, 2017 · 1 revision

Git

Git, find all unmerged branches

git branch --no-merged master

Maven

Site fails on JDK7 with permgen error

set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m

Generate site for only the parent module

mvn -N site

Debug maven plugins

SET MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compile=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

Out of permgen memory

Windows - set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m All others - export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"

Maven sync all dependencies and plugins, javadocs and source jars for offline building

mvn dependency:resolve -Dclassifier=javadoc dependency:sources dependency:resolve-plugins -fn

Maven run with debug

mvn -X <targets>

Updating tomcat dependencies

New version of tomcat! great, edit these files to make the build happy again

  • .travis.yml
  • apache.tomcat/pom.xml
  • fgsms-server/fgsms-tomcat/assembly.xml
  • fgsms-server/fgsms-tomcat/package.properties
  • pom.xml

Building offline or on isolated networks

After syncing all dependenices, also download apache tomcat, apache juddi and jboss esb server. Host these on a local web server that you can reach (or localhost), then add -DforceHttp to your mvn build goals

mvn clean install -DforceHttp

Debug java process started from the command line

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 -jar ... args

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 -cp ... my.MainClass args

Netbeans

Netbeans is killing my computer

On occasion it goes bonkers and will literally max out the I/O of your drive. No idea what it's doing but it's quite annoying

Potential fixes:

purge the cache (see below) disable or add exclusions for antivirus software change the maven indexing frequency (Tools > Options > Java > Indexing Tools/Options/Miscellaneous/Files => ❑ Enable auto-scanning of sources

Netbeans fails to resolve classes

Stop netbeans and blow up the cache. usually in one of the following

C:\Users\AppData\Local\NetBeans\Cache\7.2\ on Windows /Users//Library/Caches/NetBeans/7.2/ on Mac OS X /home//.cache/netbeans/7.2 on Unix-like systems

Netbeans JSP classes are not resolving classes or autocomplete

You probably didn't install the "EE" version of Netbeans, go back and install that one and try again

Useful Netbeans plugins

Convert from Unix/Java time in ms since epoch to Excel's time format

=((B5/1000)/86400)+DATEVALUE("1-1-1970") - DATEVALUE("1-1-1900")

Adding a custom header/footer to a maven generated site

In your maven site descriptor src/site/site.xml, add the following in xpath location project/body/footer

  <footer>
      <![CDATA[
    <div style="top:0px; left:0px; background-color: #00FF00; width: 100%; background-image: none; position: fixed; z-index: 9000; ">
    <div style="width: 100%; text-align: center;">
TOP BAR					
    </div>
    </div>
    
          
    <div style="bottom:0px; left:0px; background-color: #00FF00; width: 100%; background-image: none; position: fixed; z-index: 9000; ">
    <div style="width: 100%; text-align: center;">
BOTTOM BAR
    </div>
    </div>
	
      ]]>
    </footer>