Last active
February 24, 2017 18:19
-
-
Save teekaay/bf08baab69c3e6ffa73d3529bfe242e6 to your computer and use it in GitHub Desktop.
Basic Maven POM with JUnit, Cobertura, Findbugs and PMD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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>org.your.organization</groupId> | |
| <artifactId>basic-pom-file</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <packaging>jar</packaging> | |
| <properties> | |
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
| <project.mainclass>...</project.mainclass> | |
| <!-- DEPENDENCY CONFIGURATION --> | |
| <java.version>1.8</java.version> | |
| <junit.version>4.12</junit.version> | |
| <hamcrest.version>1.3</hamcrest.version> | |
| <cobertura.version>2.7</cobertura.version> | |
| <pmd.version>3.4</pmd.version> | |
| <findbugs.version>3.0.4</findbugs.version> | |
| </properties> | |
| <dependencies> | |
| <dependency> | |
| <groupId>junit</groupId> | |
| <artifactId>junit</artifactId> | |
| <version>${junit.version}</version> | |
| <scope>test</scope> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.hamcrest</groupId> | |
| <artifactId>hamcrest-core</artifactId> | |
| <version>${hamcrest.version}</version> | |
| <scope>test</scope> | |
| </dependency> | |
| </dependencies> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-compiler-plugin</artifactId> | |
| <version>3.1</version> | |
| <configuration> | |
| <source>${java.version}</source> | |
| <target>${java.version}</target> | |
| </configuration> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.codehaus.mojo</groupId> | |
| <artifactId>exec-maven-plugin</artifactId> | |
| <version>1.4</version> | |
| <configuration> | |
| <mainClass>${project.mainclass}</mainClass> | |
| </configuration> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| <reporting> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.codehaus.mojo</groupId> | |
| <artifactId>findbugs-maven-plugin</artifactId> | |
| <version>${findbugs.version}</version> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.codehaus.mojo</groupId> | |
| <artifactId>cobertura-maven-plugin</artifactId> | |
| <version>${cobertura.version}</version> | |
| <configuration> | |
| <formats> | |
| <format>html</format> | |
| <format>xml</format> | |
| </formats> | |
| </configuration> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-pmd-plugin</artifactId> | |
| <version>${pmd.version}</version> | |
| <configuration> | |
| <linkXref>true</linkXref> | |
| <sourceEncoding>utf-8</sourceEncoding> | |
| <minimumTokens>1</minimumTokens> | |
| <targetJdk>${java.version}</targetJdk> | |
| </configuration> | |
| </plugin> | |
| </plugins> | |
| </reporting> | |
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Generate cobertura, findbug and pmd reports | |
| REPORT_HTML="file://$(pwd)/target/site/project-info.html" | |
| mvn clean site | |
| echo "Open reports @ ${REPORT_HTML}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| mvn exec:java |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment