Compile error - wrong source folders are taken in a multi-module Maven project

Hello,

we are using the clover maven plugin 3.1.0 and we want to setup the clover reporting with our bamboo server.

Now we get a compile error during the clover2:setup phase: cannot find symbol symbol : class Foobar

We have a look into the project, which should hold the Foobar class. After looking at the jar file we do not found the Foobar class in it. the close2:setup has compiled the project but with the content of another project.



then I checkout the source file for the maven-clover2 plugin and add some extra output:

class CloverInstrumentInternalMojo {
...
    @Override
    public void execute() throws MojoExecutionException {
...
        System.out.println("1:" + getProject().getCompileSourceRoots());
        resetSrcDirsOriginal(getProject().getArtifact(), this);
        System.out.println("2:" + getProject().getCompileSourceRoots());

The output is:

1:[D:\Build\cmh.bamboo\compile-deploy\de.ponton.cmh.queuing.xp\src]
[DEBUG] Clover source directories before change:
[DEBUG] [Clover]  source root [D:\Build\cmh.bamboo\compile-deploy\de.ponton.cmh.queuing.xp\src]
[DEBUG] Clover main source directories after change:
[DEBUG] [Clover]  source root [D:\Build\cmh.bamboo\compile-deploy\de.ponton.cmh.auditlog.xp\src\main\java]
[DEBUG] Clover source directories before change:
[DEBUG] [Clover]  source root [D:\Build\cmh.bamboo\compile-deploy\de.ponton.cmh.queuing.xp\src\test\java]
[DEBUG] Clover main source directories after change:
[DEBUG] [Clover]  source root [D:\Build\cmh.bamboo\compile-deploy\de.ponton.cmh.queuing.xp\src\test\java]
2:[D:\Build\cmh.bamboo\compile-deploy\de.ponton.cmh.auditlog.xp\src\main\java]

Why is the plugin changing the source directory to a wrong one?

Regards, Jens

PS: sorry for the bad formatting but your editor drives my crazy.

2 answers

Hello,

I found the problem:

// HACK: this allows us to reset the source directories to the originals
private static Map originalSrcMap = new HashMap();
private static Map originalSrcTestMap = new HashMap();

This map contains the orginal source folder. We have two artifacts with the same artifact id but different group ids, therefore we got the worng source folder.

Regards, Jens

0 votes

This problem has been solved in Clover-for-Maven2&3 version 3.1.6 (bug CLOV-1026).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

48 views 0 0
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you