Skip to content
Browse files

Add example of Gradle project

  • Loading branch information...
1 parent 0ee0f22 commit 4283d29c41aeb9cddd43ba98b1c0245b370af145 @Godin Godin committed
View
5 .gitignore
@@ -1,6 +1,9 @@
# Maven
target/
+# Gradle
+.gradle/
+
# Ant Working Directory
.sonar/
@@ -25,6 +28,6 @@ Icon?
# ---- Windows
# Windows image file caches
-Thumbs.db
+Thumbs.db
# Folder config file
Desktop.ini
View
30 projects/gradle/build.gradle
@@ -0,0 +1,30 @@
+apply plugin: "java"
+apply plugin: "sonar"
+
+buildDir = "target"
+
+repositories {
+ mavenCentral()
+}
+
+configurations {
+ jacoco
+}
+
+dependencies {
+ testCompile group: "junit", name: "junit", version: "4.8.1"
+
+ jacoco group: "org.jacoco", name: "org.jacoco.agent", version: "0.5.3.201107060350", classifier: "runtime"
+}
+
+test {
+ jvmArgs "-javaagent:" + configurations.jacoco.asPath + "=destfile=" + buildDir + "/jacoco.exec,includes=example.*"
+}
+
+sonar {
+ project {
+ withProjectProperties { props ->
+ props["sonar.core.codeCoveragePlugin"] = "jacoco"
+ }
+ }
+}
View
11 projects/gradle/src/main/java/example/Greeting.java
@@ -0,0 +1,11 @@
+package example;
+
+public class Greeting {
+ public void coveredByUnitTest() {
+ System.out.println("Hello, world.");
+ }
+
+ public void notCoveredByUnitTest() {
+ System.out.println("Hello, world.");
+ }
+}
View
10 projects/gradle/src/test/java/example/GreetingTest.java
@@ -0,0 +1,10 @@
+package example;
+
+import org.junit.Test;
+
+public class GreetingTest {
+ @Test
+ public void test() {
+ new Greeting().coveredByUnitTest();
+ }
+}

0 comments on commit 4283d29

Please sign in to comment.
Something went wrong with that request. Please try again.