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

Jens Mühlenhoff September 21, 2011

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

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 2013

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

0 votes
Jens Mühlenhoff September 21, 2011

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events