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

This widget could not be displayed.

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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

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