0

I'm running Jacoco as an agent to surefire

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.18.1</version>
    <configuration>
        <argLine>${jacoco.agent.argLine}</argLine>
    </configuration>
</plugin>

I'm configuring Jacoco with a large list of exclusions (constants and my deprecated classes) for my build-breaker.

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.5.201505241946</version>
    <configuration>
        <excludes>
            <exclude>*/*Test</exclude>
            <exclude>*/*Constants*</exclude>
            <exclude>${jacoco.exclusions.list}</exclude>
        </excludes>
    </configuration>  

What I'm getting is that when I go to run the tests I get the error:


 T E S T S
-------------------------------------------------------
The command line is too long.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------  

Is there another way to pass the exclusions list to Jacoco than on the agent parameter arglist on the command line? (Looking at the code it doesn't look like it)

My question is: How to pass the list of exclusions to the Jacoco agent running in surefire other than on the command line?

hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • Could you please elaborate - why you need a long exclusion list for agent and not for report generation? As stated on page http://www.jacoco.org/jacoco/trunk/doc/agent.html : "Except for performance optimization or technical corner cases this option is normally not required." – Godin Jan 20 '17 at 09:37
  • This is a technical corner case. – hawkeye Jan 20 '17 at 11:04
  • Could you please elaborate more about "corner case"? I'm asking not because of curiosity, but as one of JaCoC developers in order to understand which improvements we can do. – Godin Jan 21 '17 at 13:32

1 Answers1

0

As of today JaCoCo Java Agent doesn't allow reading of options from files.

However you can specify agent via environment variable JAVA_TOOL_OPTIONS, which supposed to have bigger size limit than command line.

Also JaCoCo in offline mode (without agent) allows to provide configuration via file jacoco-agent.properties.

Godin
  • 9,801
  • 2
  • 39
  • 76