Generate version.txt in a maven project

If you need to generate a txt with project version / timestamp in project’s root you can use an ant build like this.


<plugins>

...


<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  	<version>1.8</version>
	<executions>
  	<execution>
	<phase>prepare-package</phase>
	<configuration>
	   <tasks>
	     <tstamp>
		<format property="now" pattern="yyyy-MM-dd hh:mm:ss" locale="it" />
		  </tstamp>
		    <echo file="<path>/version.txt" append="false">
			Project Version : ${project.version} ${line.separator}Build @ ${now}
		    </echo>
            </tasks>
         </configuration>
	    <goals>
		<goal>run</goal>
	    </goals>
	</execution>
	</executions>
</plugin>

...

</plugins>

Start H2 Db as daemon

Here my script to start H2 db as daemon under linux Os.
Please note param “-baseDir $HOME” this means that default storage path is the home of the user that start db,
change variable with absolute path to prevent new Db creation with wrong users.

 
#!/bin/sh

cd `dirname ${0}`/..

case $1 in
  help)
    java -cp <h2Path>/h2-*.jar org.h2.tools.Server -?
  ;;

  start)
    java -cp <h2Path>/h2-*.jar org.h2.tools.Server -tcp -web -baseDir $HOME &
  ;;

  stop)
    java -cp <h2Path>/h2-*.jar org.h2.tools.Server -tcpShutdown "tcp://localhost"
  ;;

  *)
    echo "Usage ${0} (help|start|stop)"
  ;;
esac