Skip to content

Refactor Scala version check and add some tests for unsupported Scala versions #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ under the License.
<artifactId>doxia-site-renderer</artifactId>
<version>1.11.1</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
5 changes: 4 additions & 1 deletion src/it/test_ScalaMavenPlugin_Scala212_JUnit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<properties>
<scala.compat.version>2.12</scala.compat.version>
<scala.minor.version>18</scala.minor.version>
<scala.minor.version>8</scala.minor.version> <!-- Testing that 2.12.8 is supported -->
</properties>

<build>
Expand All @@ -39,6 +39,9 @@
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<configuration>
<scalacPluginVersion>2.0.0</scalacPluginVersion> <!-- Downgrading for Scala 2.12.8 -->
</configuration>
</plugin>
</plugins>
</build>
Expand Down
1 change: 1 addition & 0 deletions src/it/test_skip_Scala2_10/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean verify site -e -ntp
45 changes: 45 additions & 0 deletions src/it/test_skip_Scala2_10/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>integration_tests_parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../integration_tests_parent/pom.xml</relativePath>
</parent>

<artifactId>test_skip_Scala2_10</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test Scoverage is Skipped for Scala 2.10</name>
<description>Test Scoverage is Skipped for Scala 2.10</description>

<properties>
<scala.compat.version>2.10</scala.compat.version>
<scala.minor.version>7</scala.minor.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package service

object HelloServiceScala {
def hello = { "Hello" }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package service

import org.scalatest.wordspec.AnyWordSpec

class HelloServiceScalaTest extends AnyWordSpec {

"HelloService" should {
"say hello" in {
assert(HelloServiceScala.hello == "Hello")
}
}
}
12 changes: 12 additions & 0 deletions src/it/test_skip_Scala2_10/validate.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
try {

def logFile = new File(basedir, "build.log")
def lines = logFile.readLines()
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"2.10.7\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")

return true

} catch (Throwable e) {
e.printStackTrace()
return false
}
1 change: 1 addition & 0 deletions src/it/test_skip_Scala2_11/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean verify site -e -ntp
45 changes: 45 additions & 0 deletions src/it/test_skip_Scala2_11/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>integration_tests_parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../integration_tests_parent/pom.xml</relativePath>
</parent>

<artifactId>test_skip_Scala2_11</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test Scoverage is Skipped for Scala 2.11</name>
<description>Test Scoverage is Skipped for Scala 2.11</description>

<properties>
<scala.compat.version>2.11</scala.compat.version>
<scala.minor.version>12</scala.minor.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package service

object HelloServiceScala {
def hello = { "Hello" }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package service

import org.scalatest.wordspec.AnyWordSpec

class HelloServiceScalaTest extends AnyWordSpec {

"HelloService" should {
"say hello" in {
assert(HelloServiceScala.hello == "Hello")
}
}
}
12 changes: 12 additions & 0 deletions src/it/test_skip_Scala2_11/validate.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
try {

def logFile = new File(basedir, "build.log")
def lines = logFile.readLines()
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"2.11.12\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")

return true

} catch (Throwable e) {
e.printStackTrace()
return false
}
1 change: 1 addition & 0 deletions src/it/test_skip_Scala2_12_7/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean verify site -e -ntp
55 changes: 55 additions & 0 deletions src/it/test_skip_Scala2_12_7/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>integration_tests_parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../integration_tests_parent/pom.xml</relativePath>
</parent>

<artifactId>test_skip_Scala2_12_7</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test Scoverage is Skipped for Scala 2.12.7</name>
<description>Test Scoverage is Skipped for Scala 2.12.7</description>

<properties>
<scala.compat.version>2.12</scala.compat.version>
<scala.minor.version>7</scala.minor.version>
<scoverage.scalacPluginVersion>2.0.0</scoverage.scalacPluginVersion>
</properties>

<profiles>
<profile>
<id>run</id>
<activation>
<jdk>11</jdk> <!-- Only run on JDK 11, as Scala 2.12.7 has issues running on JDK 17 -->
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package service

object HelloServiceScala {
def hello = { "Hello" }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package service

import org.scalatest.wordspec.AnyWordSpec

class HelloServiceScalaTest extends AnyWordSpec {

"HelloService" should {
"say hello" in {
assert(HelloServiceScala.hello == "Hello")
}
}
}
12 changes: 12 additions & 0 deletions src/it/test_skip_Scala2_12_7/validate.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
try {

def logFile = new File(basedir, "build.log")
def lines = logFile.readLines()
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"2.12.7\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")

return true

} catch (Throwable e) {
e.printStackTrace()
return false
}
1 change: 1 addition & 0 deletions src/it/test_skip_Scala3_1/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean verify site -e -ntp
46 changes: 46 additions & 0 deletions src/it/test_skip_Scala3_1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>it.scoverage-maven-plugin</groupId>
<artifactId>integration_tests_parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../integration_tests_parent/pom.xml</relativePath>
</parent>

<artifactId>test_skip_Scala3_1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test Scoverage is Skipped for Scala 3.1</name>
<description>Test Scoverage is Skipped for Scala 3.1</description>

<properties>
<scala.compat.version>3</scala.compat.version>
<scala.version>3.1.0</scala.version>
<scala.library.artifact.id>scala3-library_3</scala.library.artifact.id>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package service

object HelloServiceScala {
def hello = { "Hello" }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package service

import org.scalatest.wordspec.AnyWordSpec

class HelloServiceScalaTest extends AnyWordSpec {

"HelloService" should {
"say hello" in {
assert(HelloServiceScala.hello == "Hello")
}
}
}
12 changes: 12 additions & 0 deletions src/it/test_skip_Scala3_1/validate.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
try {

def logFile = new File(basedir, "build.log")
def lines = logFile.readLines()
assert lines.contains("[WARNING] Skipping SCoverage execution - unsupported Scala version \"3.1.0\". Supported Scala versions are 2.12.8+, 2.13.0+ and 3.2.0+ .")

return true

} catch (Throwable e) {
e.printStackTrace()
return false
}
Loading