Reputation: 3
I am trying to run some spock tests with Maven. I already ran tests before with groovy version 2.4. Now when I switched to 2.5+, it shows some error.
My minimal pom is:
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.14</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.0-groovy-2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.homeaway.devtools.jenkins</groupId>
<artifactId>jenkins-spock</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<forkCount>1</forkCount>
<includes>
<include>${test.pattern}</include>
</includes>
<useManifestOnlyJar>false</useManifestOnlyJar>
<systemPropertyVariables>
<root.loglevel>${test.loglevel}</root.loglevel>
<root.appender>Stdout</root.appender>
<test.loglevel>${test.loglevel}</test.loglevel>
<logdir>${logdir}</logdir>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6.1</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>compile</goal>
<goal>compileTests</goal>
</goals>
<configuration>
<sources>
<source>
<directory>src</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
<testSources>
<testSource>
<directory>test</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</testSource>
</testSources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
My project structure is as follows:
src
│ └── test
│ ├── vars
│ │ ├── gitCloneSpec.groovy
│ │ ├── GitRepoCloneSpec.groovy
vars
| └── ├── gitClone.groovy
│ ├── GitRepoClone.groovy
Here is the error report: Although I already have dependency jenkins-spock in my pom, why do I get this error?
Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.6.1:compile (default) on project devops-pdk-psl: Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: startup failed:
[ERROR] src/test/vars/gitCloneSpec.groovy: 1: unable to resolve class com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification
[ERROR] @ line 1, column 1.
[ERROR] import com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification;
[ERROR] ^
[ERROR]
[ERROR] src/test/vars/GitRepoCloneSpec.groovy: 1: unable to resolve class com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification
[ERROR] @ line 1, column 1.
[ERROR] import com.homeaway.devtools.jenkins.testing.JenkinsPipelineSpecification;
[ERROR] ^
[ERROR]
[ERROR] 2 errors
Upvotes: 0
Views: 352