-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip jacoco instrumentation for mvn modules with package type ear #169
Conversation
Hello there, I now included a sample project, however could not reproduce the error. @jlupi: do you execute any tests in your EAR? The default lifecycle for EARs (http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference) does not execute surefire:test at all :-) |
@mfriedenhagen no, of course I do not run any tests inside the ear module, and there are no java classes inside :) . It is just a sub-module of a maven multi module project. From what I observed jacoco instruments every submodule until you explicitly set the skip property. The maven lifecycle is my point. Mvn does not execute the compile goal for ear packaged modules because there is nothing to compile. That's why it should be skipped by default ;-) |
@jlupi: this is not always of course :-).
Other solutions:
While #170 does skip the execution for POMs and EARs, you may easily define other packagings without classes easily. So the best solution would be to check for the existence of |
reproduce the issue.
@jlupi: I am only able to reproduce your issue by adding a jar project without any classes. |
the check for an existing outputDirectory will hide the error for the invalid data-file.
@mfriedenhagen I do use //project/build/pluginManagement/plugins in the parent pom. Anyway, checking for the existence of target/classes will work for me. For now I'll just skip the module. Thanks. |
@jlupi: I still do not see, why the report goal runs at all in your EAR. In 0.6.4 there is already a check for the existence of the datafile (
|
@mfriedenhagen I think that reasonable to ask @jlupi for reproducer (small example project) instead of wasting time on guesses ;) |
@mfriedenhagen Looks good to me. |
Skip jacoco instrumentation for mvn modules with package type ear.
In a multi module maven project ear modules are never compiled (similar to pom packaged modules) and the /target/classes directory is never created.
Jacoco correctly skipps modules with pom packaging but it tries to instrument ear modules, which leads to the following error
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.3.201306030806:report (post-test) on project mct-vermittler-vertriebsmanagement-ear: Execution post-test of goal org.jacoco:jacoco-maven-plugin:0.6.3.201306030806:report failed: basedir /var/data/jenkins/workspace/mvp.mct.vermittler-vertriebsmanagement.git.nightly/mct-vermittler-vertriebsmanagement-ear/target/classes does not exist
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at ...
Caused by: java.lang.IllegalStateException: basedir /var/data/jenkins/workspace/my-project-dir/my-module-ear/target/classes does not exist
at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:550)
at org.codehaus.plexus.util.FileUtils.getFileAndDirectoryNames(FileUtils.java:1717)
at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1645)