Skip to content
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

Include M2E ignore file in jacoco-maven-plugin #203

Closed
ansell opened this issue Apr 4, 2014 · 16 comments
Closed

Include M2E ignore file in jacoco-maven-plugin #203

ansell opened this issue Apr 4, 2014 · 16 comments

Comments

@ansell
Copy link

ansell commented Apr 4, 2014

Could jacoco include a file like the following with each of the goals that should not be run by M2E in the list of goals so that M2E users do not need to manually ignore it? The file needs to be in the plugin jar file at META-INF/m2e/lifecycle-mapping-metadata.xml

More documentation can be found at: http://wiki.eclipse.org/M2E_compatible_maven_plugins

<lifecycleMappingMetadata>
  <pluginExecutions>
    <pluginExecution>
      <pluginExecutionFilter>
        <goals>
          <goal>some-goal</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>
  </pluginExecutions>
</lifecycleMappingMetadata>
@ansell
Copy link
Author

ansell commented Apr 4, 2014

I can contribute a fix but I am not sure where to put the file as the maven plugin doesn't use the standard maven directory layout so it may not support src/main/resources/META-INF/.... Should I create a new resources directory next to the src directory? Ie, "jacoco-maven-plugin/resources"?

@marchof
Copy link
Member

marchof commented Apr 4, 2014

This should already be in place in the Eclipse plugin for JaCoCo (EclEmma):

https://github.com/jacoco/eclemma/blob/master/com.mountainminds.eclemma.core/lifecycle-mapping-metadata.xml

Can you please verify whether this works for you?

@ansell
Copy link
Author

ansell commented Apr 4, 2014

Hi Marc,

I am not sure how that is relevant to M2E and jacoco-maven-plugin. Do I need to install that Eclipse plugin to avoid seeing the M2E messages?

Is it possible for you to copy and paste (or move) the file into jacoco-maven-plugin.jar so it comes directly through Maven without the extra plugin?

Thanks,

Peter

On 4 Apr 2014, at 5:06 pm, "Marc R. Hoffmann" notifications@github.com wrote:

This should already be in place in the Eclipse plugin for JaCoCo (EclEmma):

https://github.com/jacoco/eclemma/blob/master/com.mountainminds.eclemma.core/lifecycle-mapping-metadata.xml

Can you please verify whether this works for you?


Reply to this email directly or view it on GitHub.

@marchof
Copy link
Member

marchof commented Apr 4, 2014

Hi Peter, I see your point. Can you please install EclEmma and check whether it works for you as expected?

Then we can port this to jacoco-maven-plugin -- if it does not introduce a dependency on M2E.

@ansell
Copy link
Author

ansell commented Apr 6, 2014

Thanks, installing EclEmma fixed the bug!

It would however be easiest to also copy the file into the jacoco-maven-plugin so that all M2E users get it automatically. There is no extra dependency on M2E. As with the file inside of the EclEmma plugin jar file, M2E will automatically detect it based on scanning the classpath for all matching META-INF... files.

@marchof
Copy link
Member

marchof commented Apr 7, 2014

The current definition in org.mountainminds.eclemma.core only excludes the goal "prepare-agent". What about the other goals provided by JaCoCo?

@ansell
Copy link
Author

ansell commented Apr 14, 2014

Including all of the goals that could be included in a pom.xml file would be useful in my view:

prepare-agent
prepare-agent-integration
merge
report
report-integration
check
instrument
restore-instrumented-classes

The ones that are unlikely to ever be included in pom.xml, and run manually instead may not need to be there:

help
dump

The list above is based on:

http://www.eclemma.org/jacoco/trunk/doc/maven.html

@rtack
Copy link
Contributor

rtack commented Mar 26, 2015

can this be closed? has it been released?

@Godin
Copy link
Member

Godin commented Mar 26, 2015

@rtack lifecycle mapping was added into Eclemma Eclipse plugin ( see jacoco/eclemma@d89be28 ), whereas this ticket is about addition directly into jacoco-maven-plugin, which wasn't done yet.

@rtack
Copy link
Contributor

rtack commented Mar 27, 2015

would a PR help solving this?

@ansell
Copy link
Author

ansell commented Mar 28, 2015

Yes, a PR would help. I am still a little confused by the build system here and where a resource would be added, as it doesn't look like it would be src/main/resources/META-INF/ as usual for maven.

@Godin Godin self-assigned this Mar 29, 2015
@Godin Godin added this to the 0.7.5 milestone Mar 29, 2015
@Godin
Copy link
Member

Godin commented Mar 29, 2015

@rtack @ansell could you please build plugin from PR #299 and check that all fine with M2E? And if so, it will be merged into master and available in next release.

@ansell
Copy link
Author

ansell commented Mar 30, 2015

I get a compilation error when I compile from the git repository using oracle jdk 8:

[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ org.jacoco.core.test ---
[INFO] Compiling 105 source files to /home/peter/gitrepos/jacoco/org.jacoco.core.test/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/peter/gitrepos/jacoco/org.jacoco.core.test/src/org/jacoco/core/test/validation/java8/LambdaExpressionsTarget.java:[26,10] error: lambda expressions are not supported in -source 1.5
[ERROR](use -source 8 or higher to enable lambda expressions)
/home/peter/gitrepos/jacoco/org.jacoco.core.test/src/org/jacoco/core/test/validation/java8/InterfaceDefaultMethodsTarget.java:[23,1] error: default methods are not supported in -source 1.5
[INFO] 2 errors

Looking at the pom.xml file there is a profile that I could select to disable the compilation of those classes, but it isn't clear why the compilation should work for java-8 users, given that the source and target for the maven-compiler-plugin are both inherited from the maven.compiler.source and maven.compiler.target properties defined in the org.jacoco.build pom, with or without the profile being active.

My environment is Oracle JDK 8 on Ubuntu 14.04:
$ mvn -version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T06:58:10+10:00)
Maven home: /opt/apache-maven-3.2.3
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_AU, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-46-generic", arch: "amd64", family: "unix"

After compiling using "mvn -Pno-java8-validation clean install", it seems to work.

I verified that the M2E error appears with 0.7.4.201502262128 but does not appear when I changed that to 0.7.5-SNAPSHOT to use my locally compiled version.

Thanks!

@Godin
Copy link
Member

Godin commented Mar 30, 2015

@ansell let's don't mix subjects - I created #300 to address difficulties with build. In the meantime #299 has been merged. Thank you for testing.

@Godin Godin closed this as completed Mar 30, 2015
@ansell
Copy link
Author

ansell commented Mar 30, 2015

Sorry, didn't mean to confuse the issue, just describing what happened when I did the testing.

@Godin
Copy link
Member

Godin commented Mar 30, 2015

@ansell no pb.

@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants