How to exclude the specific files from coverage report?

I am trying to exclude config classes from coverage report. I defined exclusions in pom.xml. But still I can see coverage for config files in sonar report.

<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
        		<version>0.8.4</version>
				<configuration>
				</configuration>
				<executions>
					<execution>
						<id>start-agent</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
					<execution>
						<id>generate-report</id>
						<phase>test</phase>
						<goals>
							<goal>report</goal>
						</goals>
						<configuration>
							<title>Coverage with JaCoCo</title>
							<excludes>
								<exclude>
									src/main/java/**/*Config.java
								</exclude>
							</excludes>
						</configuration>
					</execution>
				</executions>
			</plugin>

Pls let me know if I am missing anything?

Hey there.

If you’re looking for how to exclude information from the JaCoCo reports themselves… you’ll have reference the documentation of JaCoCo / ask the maintainers.

If you’re just interested in excluding certain files for code coverage in SonarQube, check the documentation on Narrowing the Focus > Code Coverage Exclusions.