Skip to content

Commit 03a7a42

Browse files
committed
Fix reporting and add a minimal set of it-tests
1 parent 569ca45 commit 03a7a42

File tree

23 files changed

+526
-14
lines changed

23 files changed

+526
-14
lines changed

pom.xml

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ under the License.
140140
<dependency>
141141
<groupId>org.apache.maven.reporting</groupId>
142142
<artifactId>maven-reporting-api</artifactId>
143-
<version>3.1.0</version>
143+
<version>3.1.1</version>
144144
</dependency>
145145

146146
<dependency>
147147
<groupId>org.apache.maven.doxia</groupId>
148148
<artifactId>doxia-site-renderer</artifactId>
149-
<version>1.0</version>
149+
<version>1.11.1</version>
150150
</dependency>
151151
</dependencies>
152152

@@ -226,7 +226,7 @@ under the License.
226226
<plugin>
227227
<groupId>org.apache.maven.plugins</groupId>
228228
<artifactId>maven-invoker-plugin</artifactId>
229-
<version>3.1.0</version>
229+
<version>3.6.0</version>
230230
</plugin>
231231

232232
<plugin>
@@ -305,7 +305,7 @@ under the License.
305305
<plugin>
306306
<groupId>org.apache.maven.plugins</groupId>
307307
<artifactId>maven-project-info-reports-plugin</artifactId>
308-
<version>3.0.0</version>
308+
<version>3.5.0</version>
309309
</plugin>
310310

311311
<plugin>
@@ -332,14 +332,7 @@ under the License.
332332
<plugin>
333333
<groupId>org.apache.maven.plugins</groupId>
334334
<artifactId>maven-site-plugin</artifactId>
335-
<version>3.7.1</version>
336-
<dependencies>
337-
<dependency>
338-
<groupId>org.apache.maven.doxia</groupId>
339-
<artifactId>doxia-module-markdown</artifactId>
340-
<version>1.8</version>
341-
</dependency>
342-
</dependencies>
335+
<version>3.12.1</version>
343336
</plugin>
344337

345338
<plugin>
@@ -763,6 +756,51 @@ under the License.
763756
</plugins>
764757
</build>
765758
</profile>
759+
760+
<profile>
761+
<id>integration-tests</id>
762+
<activation>
763+
<property>
764+
<name>maven.test.skip</name>
765+
<value>!true</value>
766+
</property>
767+
</activation>
768+
<build>
769+
<plugins>
770+
<plugin>
771+
<artifactId>maven-invoker-plugin</artifactId>
772+
<executions>
773+
<execution>
774+
<phase>integration-test</phase>
775+
<id>integration-tests</id>
776+
<goals>
777+
<goal>install</goal>
778+
<goal>run</goal>
779+
</goals>
780+
</execution>
781+
</executions>
782+
<configuration>
783+
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
784+
<debug>false</debug>
785+
<streamLogs>true</streamLogs>
786+
<projectsDirectory>src/it</projectsDirectory>
787+
<pomIncludes>
788+
<pomInclude>**/pom.xml</pomInclude>
789+
</pomIncludes>
790+
<pomExcludes>
791+
<pomExclude>**/off-*/pom.xml</pomExclude>
792+
<pomExclude>**/off-*/**/pom.xml</pomExclude>
793+
<pomExclude>**/mi*/pom.xml</pomExclude>
794+
<pomExclude>**/integration_tests_parent/pom.xml</pomExclude>
795+
</pomExcludes>
796+
<preBuildHookScript>setup.groovy</preBuildHookScript>
797+
<postBuildHookScript>validate.groovy</postBuildHookScript>
798+
</configuration>
799+
</plugin>
800+
</plugins>
801+
</build>
802+
</profile>
803+
766804
</profiles>
767805

768806
</project>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>it.scoverage-maven-plugin</groupId>
8+
<artifactId>integration_tests_parent</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>pom</packaging>
11+
<name>Scoverage Plugin Integration Tests Parent</name>
12+
<description>Scoverage Plugin Integration Tests Parent</description>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<junit.version>4.13</junit.version>
17+
<scalatest.version>3.2.17</scalatest.version>
18+
19+
<compiler.plugin.version>3.11.0</compiler.plugin.version>
20+
<surefire.plugin.version>3.1.2</surefire.plugin.version>
21+
<scala.plugin.version>4.8.1</scala.plugin.version>
22+
<scalatest.plugin.version>2.0.0</scalatest.plugin.version>
23+
<project-info-reports.plugin.version>3.5.0</project-info-reports.plugin.version>
24+
<site.plugin.version>3.12.1</site.plugin.version>
25+
26+
<scala.compat.version>2.13</scala.compat.version>
27+
<scala.minor.version>12</scala.minor.version>
28+
<scala.version>${scala.compat.version}.${scala.minor.version}</scala.version>
29+
</properties>
30+
31+
<dependencies>
32+
<dependency>
33+
<groupId>org.scala-lang</groupId>
34+
<artifactId>scala-library</artifactId>
35+
<version>${scala.version}</version>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>junit</groupId>
40+
<artifactId>junit</artifactId>
41+
<version>${junit.version}</version>
42+
<scope>test</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.scalatest</groupId>
46+
<artifactId>scalatest_${scala.compat.version}</artifactId>
47+
<version>${scalatest.version}</version>
48+
<scope>test</scope>
49+
</dependency>
50+
</dependencies>
51+
52+
<build>
53+
<sourceDirectory>src/main/scala</sourceDirectory>
54+
<testSourceDirectory>src/test/scala</testSourceDirectory>
55+
56+
<pluginManagement>
57+
<plugins>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-compiler-plugin</artifactId>
61+
<version>${compiler.plugin.version}</version>
62+
<configuration>
63+
<skipMain>true</skipMain> <!-- skip compile -->
64+
<skip>true</skip> <!-- skip testCompile -->
65+
</configuration>
66+
</plugin>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-surefire-plugin</artifactId>
70+
<version>${surefire.plugin.version}</version>
71+
</plugin>
72+
<plugin>
73+
<groupId>net.alchim31.maven</groupId>
74+
<artifactId>scala-maven-plugin</artifactId>
75+
<version>${scala.plugin.version}</version>
76+
<executions>
77+
<execution>
78+
<id>default-sbt-compile</id>
79+
<goals>
80+
<goal>compile</goal>
81+
<goal>testCompile</goal>
82+
</goals>
83+
</execution>
84+
</executions>
85+
</plugin>
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-site-plugin</artifactId>
89+
<version>${site.plugin.version}</version>
90+
</plugin>
91+
<plugin>
92+
<groupId>@project.groupId@</groupId>
93+
<artifactId>@project.artifactId@</artifactId>
94+
<version>@project.version@</version>
95+
</plugin>
96+
<plugin>
97+
<groupId>org.scalatest</groupId>
98+
<artifactId>scalatest-maven-plugin</artifactId>
99+
<version>${scalatest.plugin.version}</version>
100+
<executions>
101+
<execution>
102+
<id>test</id>
103+
<phase>test</phase>
104+
<goals>
105+
<goal>test</goal>
106+
</goals>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
</plugins>
111+
</pluginManagement>
112+
</build>
113+
114+
<reporting>
115+
<plugins>
116+
<plugin>
117+
<groupId>org.apache.maven.plugins</groupId>
118+
<artifactId>maven-project-info-reports-plugin</artifactId>
119+
<version>${project-info-reports.plugin.version}</version>
120+
<reportSets>
121+
<reportSet>
122+
<reports>
123+
<report>index</report>
124+
</reports>
125+
</reportSet>
126+
</reportSets>
127+
</plugin>
128+
129+
<plugin>
130+
<groupId>@project.groupId@</groupId>
131+
<artifactId>@project.artifactId@</artifactId>
132+
<version>@project.version@</version>
133+
<reportSets>
134+
<reportSet>
135+
<reports>
136+
<report>report</report> <!-- select only one report from: report, integration-report and report-only reporters -->
137+
</reports>
138+
</reportSet>
139+
</reportSets>
140+
</plugin>
141+
</plugins>
142+
</reporting>
143+
144+
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_ScalaMavenPlugin_Scala212_JUnit</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>jar</packaging>
17+
<name>Test Scoverage Report using scala-maven-plugin, Scala 2.12 and JUnit</name>
18+
<description>Test Scoverage Report using scala-maven-plugin, Scala 2.12 and JUnit</description>
19+
20+
<properties>
21+
<scala.compat.version>2.12</scala.compat.version>
22+
<scala.minor.version>18</scala.minor.version>
23+
</properties>
24+
25+
<build>
26+
<plugins>
27+
<plugin>
28+
<groupId>org.apache.maven.plugins</groupId>
29+
<artifactId>maven-compiler-plugin</artifactId>
30+
</plugin>
31+
<plugin>
32+
<groupId>net.alchim31.maven</groupId>
33+
<artifactId>scala-maven-plugin</artifactId>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-surefire-plugin</artifactId>
38+
</plugin>
39+
<plugin>
40+
<groupId>@project.groupId@</groupId>
41+
<artifactId>@project.artifactId@</artifactId>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package service
2+
3+
object HelloServiceScala {
4+
def hello = { "Hello" }
5+
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package service
2+
3+
import org.junit.Test;
4+
import org.junit.Assert.assertEquals
5+
6+
class HelloServiceScalaTest
7+
{
8+
@Test
9+
def test1() = assertEquals("Hello", HelloServiceScala.hello)
10+
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
try {
2+
3+
def logFile = new File(basedir, "build.log")
4+
def lines = logFile.readLines()
5+
assert lines.contains("[INFO] Statement coverage.: 100.00%")
6+
assert lines.contains("[INFO] Branch coverage....: 100.00%")
7+
8+
def scoverageFile = new File(basedir, "target/scoverage.xml")
9+
assert scoverageFile.exists()
10+
11+
def reportFile = new File(basedir, "target/site/scoverage/index.html")
12+
assert reportFile.exists()
13+
14+
return true
15+
16+
} catch (Throwable e) {
17+
e.printStackTrace()
18+
return false
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invoker.goals=clean verify site -e -ntp
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>it.scoverage-maven-plugin</groupId>
9+
<artifactId>integration_tests_parent</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../integration_tests_parent/pom.xml</relativePath>
12+
</parent>
13+
14+
<artifactId>test_ScalaMavenPlugin_Scala212_ScalaTest</artifactId>
15+
<version>1.0-SNAPSHOT</version>
16+
<packaging>jar</packaging>
17+
<name>Test Scoverage Report using scala-maven-plugin, Scala 2.12 and ScalaTest</name>
18+
<description>Test Scoverage Report using scala-maven-plugin, Scala 2.12 and ScalaTest</description>
19+
20+
<properties>
21+
<scala.compat.version>2.12</scala.compat.version>
22+
<scala.minor.version>18</scala.minor.version>
23+
</properties>
24+
25+
<build>
26+
<plugins>
27+
<plugin>
28+
<groupId>org.apache.maven.plugins</groupId>
29+
<artifactId>maven-compiler-plugin</artifactId>
30+
</plugin>
31+
<plugin>
32+
<groupId>net.alchim31.maven</groupId>
33+
<artifactId>scala-maven-plugin</artifactId>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.scalatest</groupId>
37+
<artifactId>scalatest-maven-plugin</artifactId>
38+
</plugin>
39+
<plugin>
40+
<groupId>@project.groupId@</groupId>
41+
<artifactId>@project.artifactId@</artifactId>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package service
2+
3+
object HelloServiceScala {
4+
def hello = { "Hello" }
5+
6+
}

0 commit comments

Comments
 (0)