Skip to content

Unable to resolve groovy source in test files #321

@ghost

Description

I am fairly new to Groovy. I have created a groovy project and have converted it to maven. I use Eclipse Kepler with groovy support for development.
When I run the maven build locally, everything works fine, but when I run the build on Jenkins, I see unresolved groovy source file errors and all the compilation errors are only in test cases.
Does anyone know why do I have an issue on Jenkins? Any pointers on this would be vey helpful.
section in my pom.xml file looks like below. Thank you.

<build>
	<sourceDirectory>src/groovy</sourceDirectory>
	<testSourceDirectory>test/groovy</testSourceDirectory>
	<plugins>
		<plugin>
			<artifactId>maven-compiler-plugin</artifactId>
			<!-- 2.8.0-01 and later require maven-compiler-plugin 3.1 or higher -->
			<version>3.1</version>
			<configuration>
				<compilerId>groovy-eclipse-compiler</compilerId>
				<source>${jdk.version}</source>
				<target>${jdk.version}</target>
			</configuration>
			<dependencies>
				<dependency>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-eclipse-compiler</artifactId>
					<version>2.9.1-01</version>
				</dependency>
				<dependency>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-eclipse-batch</artifactId>
					<version>2.3.7-01</version>
				</dependency>
			</dependencies>
			<executions>
				<execution>
					<phase>test-compile</phase>
					<goals>
						<goal>testCompile</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.grails</groupId>
			<artifactId>grails-maven-plugin</artifactId>
			<version>2.4.4</version>
			<configuration>
				<skipTests>true</skipTests>
				<fork>true</fork>
			</configuration>
			<extensions>true</extensions>
			<executions>
				<execution>
					<goals>
						<goal>package-plugin</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-surefire-plugin</artifactId>
			<version>2.9</version>
			<executions>
				<execution>
					<phase>test</phase>
					<goals>
						<goal>test</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>build-helper-maven-plugin</artifactId>
			<version>1.5</version>
			<executions>
				<execution>
					<id>add-source</id>
					<phase>generate-sources</phase>
					<goals>
						<goal>add-source</goal>
					</goals>
					<configuration>
						<sources>
							<source>grails-app/services</source>
						</sources>
					</configuration>
				</execution>
				<execution>
					<id>add-test-source</id>
					<phase>generate-test-sources</phase>
					<goals>
						<goal>add-test-source</goal>
					</goals>
					<configuration>
						<sources>
							<source>test/groovy</source>
							<source>test/java</source>
						</sources>
					</configuration>
				</execution>
				<execution>
					<id>add-test-resource</id>
					<phase>generate-test-sources</phase>
					<goals>
						<goal>add-test-resource</goal>
					</goals>
					<configuration>
						<resources>
							<resource>
								<directory>test/groovy</directory>
								<excludes>
									<exclude>**/*.groovy</exclude>
								</excludes>
							</resource>
						</resources>
					</configuration>
				</execution>
			</executions>
		</plugin>
		<plugin>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>cobertura-maven-plugin</artifactId>
			<version>2.7</version>
			<configuration>
				<formats>
					<format>html</format>
					<format>xml</format>
				</formats>
			</configuration>
		</plugin>
	</plugins>
</build>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions