Skip to content

Commit 64b4f61

Browse files
committed
Merge branch 'metteo-redirect-test-output-to-file'
2 parents 832678c + 5068778 commit 64b4f61

File tree

13 files changed

+374
-100
lines changed

13 files changed

+374
-100
lines changed

.github/workflows/maven.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: scalatest-maven-plugin
2+
3+
on: [push]
4+
5+
jobs:
6+
verify:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: git
12+
uses: actions/checkout@v2
13+
14+
- name: java
15+
uses: actions/[email protected]
16+
with:
17+
java-version: '8'
18+
19+
- name: maven
20+
run: mvn -B clean verify --file pom.xml

pom.xml

+96-83
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0"?>
2-
<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/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
35
<modelVersion>4.0.0</modelVersion>
46

57
<parent>
@@ -19,10 +21,13 @@
1921
<scala.major.version>2.11</scala.major.version>
2022
<scala.minor.version>12</scala.minor.version>
2123
<scala.version>${scala.major.version}.${scala.minor.version}</scala.version>
24+
2225
<scalatest.version>3.0.1</scalatest.version>
2326
<scala.maven.plugin.version>4.3.0</scala.maven.plugin.version>
27+
2428
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2529
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
30+
2631
<build.timestamp>${maven.build.timestamp}</build.timestamp>
2732
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
2833
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
@@ -32,7 +37,8 @@
3237
<junit.version>4.12</junit.version>
3338
<maven.reporting.api.version>3.0</maven.reporting.api.version>
3439
<maven.enforcer.plugin.version>1.4.1</maven.enforcer.plugin.version>
35-
<java.version>6</java.version>
40+
41+
<java.version>8</java.version>
3642
</properties>
3743

3844
<licenses>
@@ -129,16 +135,6 @@
129135
</pluginManagement>
130136

131137
<plugins>
132-
133-
<plugin>
134-
<groupId>org.apache.maven.plugins</groupId>
135-
<artifactId>maven-javadoc-plugin</artifactId>
136-
<version>2.7</version>
137-
<configuration>
138-
<additionalparam>-Xdoclint:none</additionalparam>
139-
</configuration>
140-
</plugin>
141-
142138
<plugin>
143139
<groupId>net.alchim31.maven</groupId>
144140
<artifactId>scala-maven-plugin</artifactId>
@@ -161,8 +157,8 @@
161157
<artifactId>maven-compiler-plugin</artifactId>
162158
<version>3.8.1</version>
163159
<configuration>
164-
<source>1.${java.version}</source>
165-
<target>1.${java.version}</target>
160+
<source>${java.version}</source>
161+
<target>${java.version}</target>
166162
</configuration>
167163
</plugin>
168164
<plugin>
@@ -194,6 +190,7 @@
194190
<pomIncludes>
195191
<pomInclude>lift/pom.xml</pomInclude>
196192
<pomInclude>spaces in path/pom.xml</pomInclude>
193+
<pomInclude>redirect-output/pom.xml</pomInclude>
197194
</pomIncludes>
198195
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
199196
<streamLogs>true</streamLogs>
@@ -206,21 +203,6 @@
206203
</goals>
207204
</configuration>
208205
</plugin>
209-
210-
<plugin>
211-
<groupId>org.apache.maven.plugins</groupId>
212-
<artifactId>maven-gpg-plugin</artifactId>
213-
<version>${maven.gpg.plugin.version}</version>
214-
<executions>
215-
<execution>
216-
<id>sign-artifacts</id>
217-
<phase>verify</phase>
218-
<goals>
219-
<goal>sign</goal>
220-
</goals>
221-
</execution>
222-
</executions>
223-
</plugin>
224206
<plugin>
225207
<groupId>org.apache.maven.plugins</groupId>
226208
<artifactId>maven-enforcer-plugin</artifactId>
@@ -245,58 +227,89 @@
245227
</plugins>
246228
</build>
247229

248-
<reporting>
249-
<plugins>
250-
<plugin>
251-
<groupId>org.apache.maven.plugins</groupId>
252-
<artifactId>maven-plugin-plugin</artifactId>
253-
<version>2.6</version>
254-
</plugin>
255-
<plugin>
256-
<groupId>org.codehaus.mojo</groupId>
257-
<artifactId>cobertura-maven-plugin</artifactId>
258-
<version>2.5.1</version>
259-
</plugin>
260-
<plugin>
261-
<groupId>org.apache.maven.plugins</groupId>
262-
<artifactId>maven-changes-plugin</artifactId>
263-
<version>2.6</version>
264-
<configuration>
265-
<filteringChanges>true</filteringChanges>
266-
</configuration>
267-
</plugin>
268-
<plugin>
269-
<groupId>org.apache.maven.plugins</groupId>
270-
<artifactId>maven-dependency-plugin</artifactId>
271-
<version>2.3</version>
272-
</plugin>
273-
<plugin>
274-
<groupId>org.apache.maven.plugins</groupId>
275-
<artifactId>maven-javadoc-plugin</artifactId>
276-
<version>2.7</version>
277-
<configuration>
278-
<charset>UTF-8</charset>
279-
<docencoding>UTF-8</docencoding>
280-
<docfilessubdirs>true</docfilessubdirs>
281-
<show>package</show>
282-
<source>1.${java.version}</source>
283-
<detectLinks>true</detectLinks>
284-
</configuration>
285-
</plugin>
286-
<plugin>
287-
<groupId>org.apache.maven.plugins</groupId>
288-
<artifactId>maven-jxr-plugin</artifactId>
289-
<version>2.2</version>
290-
<configuration>
291-
<inputEncoding>UTF-8</inputEncoding>
292-
<outputEncoding>UTF-8</outputEncoding>
293-
</configuration>
294-
</plugin>
295-
<plugin>
296-
<groupId>org.apache.maven.plugins</groupId>
297-
<artifactId>maven-surefire-report-plugin</artifactId>
298-
<version>2.5</version>
299-
</plugin>
300-
</plugins>
301-
</reporting>
230+
<profiles>
231+
<profile>
232+
<id>release</id>
233+
<build>
234+
<plugins>
235+
<plugin>
236+
<groupId>org.apache.maven.plugins</groupId>
237+
<artifactId>maven-javadoc-plugin</artifactId>
238+
<version>2.7</version>
239+
<configuration>
240+
<additionalparam>-Xdoclint:none</additionalparam>
241+
</configuration>
242+
</plugin>
243+
<plugin>
244+
<groupId>org.apache.maven.plugins</groupId>
245+
<artifactId>maven-gpg-plugin</artifactId>
246+
<version>${maven.gpg.plugin.version}</version>
247+
<executions>
248+
<execution>
249+
<id>sign-artifacts</id>
250+
<phase>verify</phase>
251+
<goals>
252+
<goal>sign</goal>
253+
</goals>
254+
</execution>
255+
</executions>
256+
</plugin>
257+
</plugins>
258+
</build>
259+
<reporting>
260+
<plugins>
261+
<plugin>
262+
<groupId>org.apache.maven.plugins</groupId>
263+
<artifactId>maven-plugin-plugin</artifactId>
264+
<version>2.6</version>
265+
</plugin>
266+
<plugin>
267+
<groupId>org.codehaus.mojo</groupId>
268+
<artifactId>cobertura-maven-plugin</artifactId>
269+
<version>2.5.1</version>
270+
</plugin>
271+
<plugin>
272+
<groupId>org.apache.maven.plugins</groupId>
273+
<artifactId>maven-changes-plugin</artifactId>
274+
<version>2.6</version>
275+
<configuration>
276+
<filteringChanges>true</filteringChanges>
277+
</configuration>
278+
</plugin>
279+
<plugin>
280+
<groupId>org.apache.maven.plugins</groupId>
281+
<artifactId>maven-dependency-plugin</artifactId>
282+
<version>2.3</version>
283+
</plugin>
284+
<plugin>
285+
<groupId>org.apache.maven.plugins</groupId>
286+
<artifactId>maven-javadoc-plugin</artifactId>
287+
<version>2.7</version>
288+
<configuration>
289+
<charset>UTF-8</charset>
290+
<docencoding>UTF-8</docencoding>
291+
<docfilessubdirs>true</docfilessubdirs>
292+
<show>package</show>
293+
<source>${java.version}</source>
294+
<detectLinks>true</detectLinks>
295+
</configuration>
296+
</plugin>
297+
<plugin>
298+
<groupId>org.apache.maven.plugins</groupId>
299+
<artifactId>maven-jxr-plugin</artifactId>
300+
<version>2.2</version>
301+
<configuration>
302+
<inputEncoding>UTF-8</inputEncoding>
303+
<outputEncoding>UTF-8</outputEncoding>
304+
</configuration>
305+
</plugin>
306+
<plugin>
307+
<groupId>org.apache.maven.plugins</groupId>
308+
<artifactId>maven-surefire-report-plugin</artifactId>
309+
<version>2.5</version>
310+
</plugin>
311+
</plugins>
312+
</reporting>
313+
</profile>
314+
</profiles>
302315
</project>

src/it/lift/verify.groovy

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ if (testSummaryLines.size == 0) {
1717
throw new Exception("Found more than one scalatest summary line in build.log")
1818
}
1919

20-
if (testSummaryLines[0].contains("Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0")) {
20+
def theLine = testSummaryLines[0]
21+
22+
if (theLine.isEmpty()) {
23+
throw new Exception("Could not find scalatest's non empty summary line in build.log")
24+
}
25+
26+
if (theLine.contains("Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0")) {
2127
throw new Exception("No tests were run by scalatest!")
2228
}
2329

src/it/redirect-output/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# redirect output
2+
3+
This project is part of scalatest-maven-plugin's suite of integration tests. It is meant to check that scalatest-maven-plugin can run for projects that use test output redirect.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# A comma or space separated list of goals/phases to execute, may
2+
# specify an empty list to execute the default goal of the IT project
3+
invoker.goals = clean test

src/it/redirect-output/pom.xml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
<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/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>redirect-output-it</artifactId>
5+
<version>1.0-SNAPSHOT</version>
6+
<packaging>jar</packaging>
7+
<name>redirect-output</name>
8+
<description>Runs the plugin for a project that uses test output redirect.</description>
9+
10+
<parent>
11+
<groupId>maven.scalatest.plugin.its</groupId>
12+
<artifactId>it-parent</artifactId>
13+
<version>1.0-SNAPSHOT</version>
14+
<relativePath>../it-parent</relativePath>
15+
</parent>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.scala-lang</groupId>
20+
<artifactId>scala-library</artifactId>
21+
<version>@scala.version@</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.scalatest</groupId>
25+
<artifactId>[email protected]@</artifactId>
26+
<version>@scalatest.version@</version>
27+
<scope>test</scope>
28+
</dependency>
29+
</dependencies>
30+
31+
<build>
32+
<sourceDirectory>src/main/scala</sourceDirectory>
33+
<testSourceDirectory>src/test/scala</testSourceDirectory>
34+
<plugins>
35+
<plugin>
36+
<groupId>net.alchim31.maven</groupId>
37+
<artifactId>scala-maven-plugin</artifactId>
38+
<version>@scala.maven.plugin.version@</version>
39+
<configuration>
40+
<recompileMode>incremental</recompileMode>
41+
<scalaVersion>${scala.version}</scalaVersion>
42+
</configuration>
43+
<executions>
44+
<execution>
45+
<id>scala-compile</id>
46+
<phase>process-resources</phase>
47+
<goals>
48+
<goal>add-source</goal>
49+
<goal>compile</goal>
50+
</goals>
51+
</execution>
52+
<execution>
53+
<id>scala-test-compile</id>
54+
<phase>process-test-resources</phase>
55+
<goals>
56+
<goal>testCompile</goal>
57+
</goals>
58+
</execution>
59+
</executions>
60+
</plugin>
61+
<!-- disable surefire -->
62+
<plugin>
63+
<groupId>org.apache.maven.plugins</groupId>
64+
<artifactId>maven-surefire-plugin</artifactId>
65+
<version>2.7</version>
66+
<configuration>
67+
<skipTests>true</skipTests>
68+
</configuration>
69+
</plugin>
70+
<!-- enable scalatest -->
71+
<plugin>
72+
<groupId>org.scalatest</groupId>
73+
<artifactId>scalatest-maven-plugin</artifactId>
74+
<configuration>
75+
<logForkedProcessCommand>true</logForkedProcessCommand>
76+
<redirectTestOutputToFile>true</redirectTestOutputToFile>
77+
</configuration>
78+
<executions>
79+
<execution>
80+
<goals>
81+
<goal>test</goal>
82+
</goals>
83+
</execution>
84+
</executions>
85+
</plugin>
86+
</plugins>
87+
</build>
88+
<reporting>
89+
<plugins>
90+
<plugin>
91+
<groupId>org.scalatest</groupId>
92+
<artifactId>scalatest-maven-plugin</artifactId>
93+
</plugin>
94+
</plugins>
95+
</reporting>
96+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.example
2+
3+
class App {
4+
def runApp(): String = {
5+
"It ran!"
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.example
2+
3+
import org.scalatest.{FlatSpec, Matchers}
4+
5+
class AppTest extends FlatSpec with Matchers {
6+
"Our example App" should "run" in {
7+
val app = new App
8+
app.runApp() shouldBe "It ran!"
9+
}
10+
}

0 commit comments

Comments
 (0)