Skip to content

Instantly share code, notes, and snippets.

@ffbit
Created September 2, 2012 17:09
Show Gist options
  • Select an option

  • Save ffbit/3601606 to your computer and use it in GitHub Desktop.

Select an option

Save ffbit/3601606 to your computer and use it in GitHub Desktop.
Java SE 6.0 Maven scaffolding
#!/bin/bash
SCRIPT_DIR=`dirname $0`
if [ -z $1 ]
then
echo "ERROR: Provide an artifact id"
exit -1
fi
mkdir -p $1/src/{main,test}/{java,resources}
touch $1/src/{main,test}/{java,resources}/.gitkeep
POM_TEMPLATE=$(less "$SCRIPT_DIR/pom.xml.template")
eval "echo \"$POM_TEMPLATE\" > $1/pom.xml"
tree -la $1
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ffbit</groupId>
<artifactId>$1</artifactId>
<version>0.0.1</version>
<developers>
<developer>
<id>ffbit</id>
<name>Dmytro Chyzhykov</name>
<email>dmytro.chyzhykov at yandex.ru</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- cobertura -->
<!-- usage "mvn clean cobertura:cobertura" -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment