Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Groovy code is not instrumented and no database is created

Oliver Fehse
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 6, 2019

Hello!

 

I want to apply Clover to Groovy code in a non-default directory (namely vars). I use Spock as test framework. I use GMavenPlus to add and compile the sources, which are recognized by Clover but not instrumented. I get the following messages:

[INFO] No Clover instrumentation done on source files in: [C:\Users\..\src\main\java, C:\..\vars] as no matching sources files found (JAVA_LANGUAGE)

 

The build section of my POM looks like this:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>

<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6.2</version>
<executions>
<execution>
<id>default-groovy-compile</id>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>compile</goal>
<goal>compileTests</goal>
</goals>
<configuration>
<sources>
<source>
<directory>${project.basedir}/vars</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
<testSources>
<testSource>
<directory>${project.basedir}/test</directory>
<includes>
<include>**/*Spec*</include>
</includes>
</testSource>
</testSources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.pluginVersion}</version>
<executions>
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/*Spec*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.3.1</version>
<executions>
<execution>
<id>default-setup</id>
<phase>generate-sources</phase>
<goals>
<goal>setup</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*</include>
</includes>
</configuration>
</plugin>

</plugins>

<resources>
<resource>
<includes>
<include>Jenkinsfile</include>
<include>jobs/**/*.groovy</include>
<include>vars/**/*.groovy</include>
</includes>
<directory>${project.basedir}</directory>
</resource>
</resources>

</build>

 

I call the build via CLI with the following command:

mvn clean test clover:aggregate clover:clover

 

The sources are added before clover:setup is called.

 

My system setup is:

Maven: 3.6.0

JDK: OpenJDK 12.0.1

Clover: 4.3.1

Groovy: 2.5.6

OS: Windows 10

 

Thanks in advance!

 

Kind Regards,

Oliver

1 answer

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2019

The 

No Clover instrumentation done on source files in ... JAVA_LANGUAGE

is a warning for missing Java code, so you shall not worry about it in your case. 

 

In your case it seems to be a problem with attaching Clover to Groovy compiler.

Enable debug logging (`mvn -X` option) and look for a message like '

Clover including the following files for Groovy instrumentation: ...

Check if any source files are listed here. If not, then there's some problem with your inclusion pattern or source roots. 

See sources of com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo#injectGrover to learn more how it work.

 

See also:

http://openclover.org/doc/manual/latest/maven--compiling-with-gmaven-plugin.html

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events