GithubHelp home page GithubHelp logo

trautonen / coveralls-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
312.0 13.0 125.0 714 KB

Maven plugin for submitting Java code coverage reports to Coveralls web service.

License: MIT License

Java 98.94% JavaScript 0.10% Shell 0.96%

coveralls-maven-plugin's Introduction

coveralls-maven-plugin

No Maintenance Intended Coverage Status Maven Central

Maven plugin for submitting Java code coverage reports to Coveralls web service.

!!! Deprecated !!!

This project is deprecated due to lack of time and interest. Please use https://github.com/hazendaz/coveralls-maven-plugin from now on.

Requirements

  • Java 6 up to 3.x and Java 7 for 4.x onwards.
  • Maven 3.0.0 or newer.

Features

  • Supports Cobertura, JaCoCo and Saga coverage tools
  • Multi-module report aggregation
  • Built-in support for Travis CI, Circle, Codeship, Jenkins, Bamboo, Shippable and Appveyor continuous integration services
  • Fully streaming implementation for fast report generation and small memory footprint
  • Provides clean interfaces to allow easy extending to different coverage tools
  • Convention over configuration for almost zero configuration usage
  • Applies semantic versioning

Usage

Set up the Coveralls maven plugin in the build section of the project pom.xml:

<plugin>
    <groupId>org.eluder.coveralls</groupId>
    <artifactId>coveralls-maven-plugin</artifactId>
    <version>4.3.0</version>
    <configuration>
        <repoToken>yourcoverallsprojectrepositorytoken</repoToken>
    </configuration>
</plugin>

Configuration

If used as a standalone Maven build or with any continuous integration server other than Travis CI, the Coveralls repository token must be provided. This can be achieved by setting the configuration section in the plugin or setting the Maven property repoToken to your coveralls project repository token, using -DrepoToken=yourcoverallsprojectrepositorytoken when running the maven command. Do not publish your repository token in public GitHub repositories. If you do, anyone can submit coverage data without permission.

If you are using Travis CI, CircleCI, Codeship, Jenkins or Bamboo continuous integration services, no other configuration is required. The plugin's built-in service environment support take care of the rest. The plugin tries to find report files for any of the supported coverage tools and finally aggregates the coverage report. Java 8 is currently supported only by JaCoCo.

See Complete plugin configuration for all of the available configuration parameters.

Cobertura

Set up the Cobertura Maven plugin with XML report format in the build section of the project pom.xml:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <format>xml</format>
        <maxmem>256m</maxmem>
        <!-- aggregated reports for multi-module projects -->
        <aggregate>true</aggregate>
    </configuration>
</plugin>

Execute Maven to create Cobertura report and submit Coveralls data:

mvn cobertura:cobertura coveralls:report

For example if you are using Travis CI this means you need to add to your .travis.yml the lines:

after_success:
  - mvn clean cobertura:cobertura coveralls:report

JaCoCo

Set up the JaCoCo Maven plugin in the build section of the project pom.xml:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.6.201602180812</version>
    <executions>
        <execution>
            <id>prepare-agent</id>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Execute Maven to create JaCoCo report and submit Coveralls data:

mvn clean test jacoco:report coveralls:report

Again, if you are using Travis CI this means you need to add to your .travis.yml the lines:

after_success:
  - mvn clean test jacoco:report coveralls:report

Saga

Set up the Saga Maven plugin in the build section of the project pom.xml:

<plugin>
    <groupId>com.github.timurstrekalov</groupId>
    <artifactId>saga-maven-plugin</artifactId>
    <version>1.5.5</version>
    <executions>
        <execution>
            <goals>
                <goal>coverage</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <baseDir>http://localhost:${jasmine.serverPort}</baseDir>
        <outputDir>${project.build.directory}/saga-coverage</outputDir>
        <noInstrumentPatterns>
            <pattern>.*/spec/.*</pattern>
            <pattern>.*/classpath/.*</pattern>
            <pattern>.*/webjars/.*</pattern>
        </noInstrumentPatterns>
    </configuration>
</plugin>

Note that Saga does not have default report output directory, but the plugin assumes ${project.build.directory}/saga-coverage.

Execute Maven to create Saga report and submit Coveralls data:

mvn clean test saga:coverage coveralls:report

And if you are using Travis CI this means you need to add to your .travis.yml the lines:

after_success:
  - mvn clean test saga:coverage coveralls:report

Aggregate multiple reports

Report aggregation is applied by default and the only thing the user must take care of is to run all the desired coverage tools. You can use JaCoCo in a multi-module project so that all modules run JaCoCo separately and let the plugin aggregate the report, or you can run Saga and Cobertura in same project and get coverage report for JavaScript and Java files.

Execute Maven to create Saga and Cobertura report and submit Coveralls data:

mvn clean test saga:coverage cobertura:cobertura coveralls:report

And if you are using Travis CI this means you need to add to your .travis.yml the lines:

after_success:
  - mvn clean test saga:coverage cobertura:cobertura coveralls:report

Complete plugin configuration

Configuration can be changed by the configuration section of plugin's definition in POM or with Java virtual machine system properties using the syntax -Dparameter=value. See Maven plugin guide how different types are mapped in the configuration XML. Some of the optional parameters are set by the built-in service environment setups. Note that if a parameter is explicitly defined, the service environment will not override it.

Parameter Type Description
jacocoReports List<File> List of additional JaCoCo report files. ${project.reporting.outputDirectory}/jacoco/jacoco.xml is used as default for every module.
coberturaReports List<File> List of additional Cobertura report files. ${project.reporting.outputDirectory}/cobertura/coverage.xml is used as default for every module.
sagaReports List<File> List of additional Saga report files. ${project.build.directory}/saga-coverage/total-coverage.xml is used as default for every module.
relativeReportDirs List<String> List of additional relative report directories. Directories relative to ${project.reporting.outputDirectory} and ${project.build.directory} are scanned for reports.
coverallsFile File Default: ${project.build.directory}/coveralls.json
File path to write and submit Coveralls data.
coverallsUrl String Default: https://coveralls.io/api/v1/jobs
Url for the Coveralls API.
sourceDirectories List<File> List of additional source directories. The plugin will scan the project's compiled source roots for defaults.
sourceEncoding String Default: ${project.build.sourceEncoding}
Source file encoding.
serviceName String CI service name. If not provided the supported service environments are used.
serviceJobId String CI service job id. Currently supported only with Travis CI. If this property is set, repoToken is not required. If not provided the supported service environments are used.
serviceBuildNumber String CI service build number. If not provided the supported service environments are used.
serviceBuildUrl String CI service build url. If not provided the supported service environments are used.
serviceEnvironment Properties CI service specific environment properties. If not provided the supported service environments are used.
repoToken String Coveralls repository token. Do not publish this parameter unencrypted in public GitHub repositories.
parallel boolean Default: false
Coveralls API flag: If this is set, the build will not be considered done until a webhook has been sent to https://coveralls.io/webhook?repo_token=…
branch String Git branch name. If not provided the supported service environments are used.
pullRequest String GitHub pull request identifier. If not provided the supported service environments are used.
timestampFormat String Default: ${maven.build.timestamp}
Build timestamp format. Must be in format supported by SimpleDateFormat.
timestamp String Default: ${timestamp}
Build timestamp. Must be in format defined by 'timestampFormat' if it's available or in default timestamp format yyyy-MM-dd'T'HH:mm:ss'Z'.
dryRun boolean Default: false
Dry run Coveralls report without actually sending it.
failOnServiceError boolean Default: true
Fail build if Coveralls service is not available or submission fails for internal errors.
scanForSources boolean Default: false
Scan subdirectories for source files.
coveralls.basedir File Default: ${project.basedir}
Base directory of the project.
coveralls.skip boolean Default: false
Skip the plugin execution.

FAQ

Q: How do I know that my coverage report was submitted successfully to Coveralls?
A: The plugin will end with BUILD SUCCESS and the log contains the reported job id and direct URL to Coveralls.

Q: I get BUILD SUCCESS but why Coveralls shows only question marks in the reports?
A: The data is most likely reported correctly, but Coveralls might take hours, or even a day, to update the actual coverage numbers.

Q: Can I use Java 8 with the plugin?
A: Yes. The Coveralls plugin works fine with Java 8, but the problem is the coverage tools. Currently only tool supporting Java 8 is JaCoCo. You can use JaCoCo in a single module or a multi-module project and let the Coveralls plugin handle the report aggregation. This is not true aggregation though and does not address cross module coverage calculation (see jacoco/jacoco#97)

Q: Build fails with 'javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated' exception, what to do?
A: If the build is run with OpenJDK, you probably hit an issue with the Cryptography Package Providers not supporting all Elliptic Curves. The issue is described in the Ubuntu issue tracker. A workaround is to disable the PKCS provider from the java.security options file.

sudo sed -i 's/security.provider.9/#security.provider.9/g' $JAVA_HOME/jre/lib/security/java.security

In Travis CI the above command can be added to before_install phase. See complete example from this project's .travis.yml.

Q: How can I use Scala or some other project which sources reside in other folder than src/main/java?
A: The plugin uses all compiled source roots available for the project at runtime. If the source directories are available, everything is fine. Otherwise additional source directories can be applied with sourceDirectories configuration parameter that takes a Maven configuration style list of source directories.

Q: How can I set the plugin to use multiple source directories?
A: For multi-module projects, the plugin automatically scans the project hierarchy and adds all required source directories. You can also customize the used source directories with sourceDirectories configuration parameter that takes a Maven configuration style list of source directories.

Q: Why source files are not found for generated sources?
A: Generated source directories under target are not added to the sources list automatically. It is often not good practice to test generated code, because the code is not managed by the project under test, unless you are testing a source generator. Cobertura and JaCoCo both have <excludes> configuration directive that provides ignoring of class files. If the generated sources still must be tested, all source directories can be explicitly defined with sourceDirectories configuration parameter.

Q: JaCoCo or Cobertura, which one should i choose?
A: For multi-module projects, only Cobertura supports report aggregation out of the box. The coverage metrics and performance of the two plugins are not much different for a small or medium sized project, but there are 2 notable differences with the tools:

  • JaCoCo does not track how many times a single line of code is hit by all the tests together, so Coveralls is always reported with 1 as the number of hits if the line is covered. Cobertura tracks the number of hits and the number is reported to Coveralls.
  • Cobertura tracks all inner classes separately, so a single source file will contain multiple records with same file name in Coveralls if there are any innner classes defined. The coveralls-maven-plugin adds classifier from the inner class to distinguish the files, but if there are lot of inner classes defined this creates some noise to the Coveralls reports. JaCoCo tracks inner classes within same source file so each source file is only reported once to Coveralls.

Changelog

See changelog for more details.

Migration

See migration documentation for more information.

Credits

  • Jakub Bednář (@bednar) for Saga integration and the idea of chaining multiple reports provided by different coverage tools.
  • Marvin Froeder (@velo) for Shippable and Appveyor support, configurable basedir and directory scanning source loader.
  • Pasi Niemi (@psiniemi) for coverage merging from different reports to single source file.

Continuous integration

Travis CI builds the plugin with Oracle JDK 7. All successfully built snapshots are deployed to Sonatype OSS repository. Cobertura is used to gather coverage metrics and the report is submitted to Coveralls with this plugin.

Using test versions

Add the following repository configurations to your pom.xml to enable snapshot versions of this plugin to be used.

  <repositories>
    <repository>
      <id>sonatype-nexus-snapshots</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases><enabled>false</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>sonatype-nexus-snapshot</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases><enabled>false</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
  </pluginRepositories>

License

The project coveralls-maven-plugin is licensed under the MIT license.

coveralls-maven-plugin's People

Contributors

aalmiray avatar andrioli avatar bednar avatar freekdb avatar joshorig avatar longtimeago avatar lpandzic avatar nurkiewicz avatar pablothiele avatar psiniemi avatar sesuncedu avatar stephanenicolas avatar tbodt avatar trautonen avatar velo avatar vertti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coveralls-maven-plugin's Issues

Coveralls source-view fails if source is in subfolder

My maven project is in a subfolder ("bar") of my github-repository.

Now the Coveralls source-view tries to open
"src/package/foo.java"
instead of
"bar/src/package/foo.java".

I was not able to add this "base folder", neither with your plugin nor directly on Coveralls (their "Git repo root directory" option only works to cut of path-parts).

Build fails with multi-module maven project

https://travis-ci.org/lightblue-platform/lightblue-applications

This project has a root pom.xml that doesn't have any source, which I suspect is the problem. There isn't anything to get coverage information from. The build fails with:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] lightblue-applications: com.redhat.lightblue.applications|pom  FAILURE [  5.499 s]
[INFO] lightblue-applications: com.redhat.lightblue.applications|apps-common  SKIPPED
[INFO] lightblue-applications: com.redhat.lightblue.applications|metadata-mgmt  SKIPPED
[INFO] lightblue-applications: com.redhat.lightblue.applications|data-mgmt  SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.413 s
[INFO] Finished at: 2014-08-11T19:40:32+00:00
[INFO] Final Memory: 21M/186M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.2.0:jacoco (default-cli) on project pom: I/O operation failed: /home/travis/build/lightblue-platform/lightblue-applications/target/coveralls.json (No such file or directory) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Source is on github, but to make things easier, .travis.yml:

language: java
jdk:
  - openjdk7
  - oraclejdk8

after_success:
  - mvn clean test jacoco:report coveralls:jacoco

And plugin configuration in the root pom.xml:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>2.2.0</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.1.201405082137</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Support multiple source directories

Support for multi module projects (#8) easily allows support for multiple source directories, which are relevant for example Java/Scala mixed projects.

Dry run property for test builds

It would be good to test what kind of Coveralls JSON the plugin creates without actually sending it to Coveralls. When dry run is enabled, the JSON would not be sent to Coveralls.

Failure when using flat package structure (my.package.name instead of my/package/name)

I used to have the following source directory: src/main/java/io.mola.galimatias. This made coveralls unable to find sources:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.1.0:cobertura (default-cli) on project galimatias: Build error: Could not find source file io/mola/galimatias/Domain.java from any source directory -> [Help 1]

Changing to src/main/java/io/mola/galimatias fixed the problem.

Failure:
https://travis-ci.org/smola/galimatias/jobs/16153713

Successful build after changing the directory structure:
https://travis-ci.org/smola/galimatias/jobs/16154263

It seems the former directory structure is increasingly common, but I'm not sure how much "standard" it is...

Source Not Available on coveralls.io

Hi,

I am using your plugin in version 3.0.0 for the following project:
xmind2latex.

Travis-CI generates and uploads reports using the following parameters:
mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report

The build succeeds but when I try to browse the sources on coveralls.io, the following error is shown:

Source Not Available
Sorry, the Github API returned an internal server error, please try refreshing this page in a moment.

Do you have any idea where my configuration fails?

Best regards,
Arne

Build fails when Coveralls API response is not in expected format

Sometimes a build on Travis CI fails, I guess because the response of Coveralls API, is not in the expected format.

A more elaborate error message, instead of the thrown ProcessingException, might be useful, fe. 'Coveralls API was unresponsive',
or showing/logging the coveralls response, for future debugging?

Some more info on the failure :
Building, testing, code coverage goes well, but transfering the result to coveralls fails :
BTW : this test was run on my own box, not on Travis CI (hence the repository token), to get some more debug info, file paths have been obfuscated.

[...]
[INFO] Cobertura Report generation was successful.
[...]
[INFO] --- coveralls-maven-plugin:2.1.0:cobertura (default-cli) @ getback_gps ---
[INFO] Starting Coveralls job
[INFO] Using repository token
[INFO] Git commit 44a49e9 in master
[INFO] Writing Coveralls data to [HOME]/target/coveralls.json from coverage report [HOME]/target/site/cobertura/coverage.xml
[INFO] Successfully wrote Coveralls data in 482ms
[INFO] Gathered code coverage metrics for 23 source files with 5157 lines of code:
[INFO] - 1123 relevant lines
[INFO] - 276 covered lines
[INFO] - 847 missed lines
[INFO] Submitting Coveralls data to API
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Caused by: org.eluder.coveralls.maven.plugin.ProcessingException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.InputStreamReader@489d479b; line: 1, column: 2]
at org.eluder.coveralls.maven.plugin.httpclient.CoverallsClient.parseResponse(CoverallsClient.java:99)
at org.eluder.coveralls.maven.plugin.httpclient.CoverallsClient.submit(CoverallsClient.java:89)
at org.eluder.coveralls.maven.plugin.AbstractCoverallsMojo.submitData(AbstractCoverallsMojo.java:300)
at org.eluder.coveralls.maven.plugin.AbstractCoverallsMojo.execute(AbstractCoverallsMojo.java:184)
... 21 more
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.InputStreamReader@489d479b; line: 1, column: 2]

ArrayIndexOutOfBoundsException on multi module build

I have a project https://github.com/hazendaz/waffle. On this project, we have builds for various versions of tomcat from 5 through 8. If I run the current 3.0.1 coveralls, it will work if I exclude tomcat 7 and 8. I've tried a few variations and it seems if I run only tomcat 7 or only tomcat 8, it also works. I don't really understand what the issue might be here. We also have multiple builds like this for spring 2 through 4 and those work without issue. Any ideas?

Here is the stack trace.
[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.1:report (default-cli) on project waffle-parent: Build error: 247 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.1:report (default-cli) on project waffle-parent: Build error
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Build error
at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:216)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 247
at org.eluder.coveralls.maven.plugin.domain.Source.addCoverage(Source.java:92)
at org.eluder.coveralls.maven.plugin.parser.JaCoCoParser.onEvent(JaCoCoParser.java:61)
at org.eluder.coveralls.maven.plugin.parser.AbstractXmlEventParser.parse(AbstractXmlEventParser.java:64)
at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.writeCoveralls(CoverallsReportMojo.java:325)
at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:205)
... 21 more

"peer not authenticated" for Codeship

Hello,

Codeship seems to have the same error with their OpenJDK. (Similar issue as #15 (comment))

There doesn't seem to be any options to select a different JDK nor can I disable the PKCS provider since their interface does not allow sudo commands.

They are currently looking into the issue are are wondering if using OpenJDK8 would fix this problem.

Support for Atlassian Clover

My project, glusterfs-java-filesystem, makes heavy use of PowerMock. As a result, Clover is the only coverage analyzer that works properly. I'd like to send reports to Coveralls and put their status image in my README.

Please consider adding support for Atlassian Clover (https://www.atlassian.com/software/clover).

Thank you in advance.

Map source files relative to git root instead of project root

Project structures that are not hierarchical will result unmappable relative source file names.

|- module1\pom.xml
|- module2\pom.xml
|- parent\pom.xml

Instead of using parent project's base dir as the root, use the git root directory, because Coveralls will base the source loading on that.

fails to parse cobertura xml

Hello,
I am trying to integrate the plugin with my application(https://github.com/shekhargulati/milestogo) but getting this exception. The TravisCI build https://travis-ci.org/shekhargulati/milestogo/jobs/20308559

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.1.0:cobertura (default-cli) on project milestogo: Processing of input or output data failed: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

Broken source link with Jacoco and missing coverage info with Cobertura

Hello,

I have a simple project to try out Travis and Coveralls using Maven and this plugin:

https://github.com/ksu-cis-501/cis501-helloworld

When using Jacoco (https://coveralls.io/builds/846183), the Coveralls source links are broken, i.e.,:

https://coveralls.io/files/218591646

When I switched to using Cobertura (https://coveralls.io/builds/858020), the plugin does not seem to find any info (https://s3.amazonaws.com/archive.travis-ci.org/jobs/27339342/log.txt):

[INFO] Writing Coveralls data to /home/travis/build/ksu-cis-501/cis501-helloworld/target/coveralls.json from coverage report /home/travis/build/ksu-cis-501/cis501-helloworld/target/site/cobertura/coverage.xml
[INFO] Successfully wrote Coveralls data in 714ms
[INFO] Gathered code coverage metrics for 0 source files with 0 lines of code:
[INFO] - 0 relevant lines
[INFO] - 0 covered lines
[INFO] - 0 missed lines
[INFO] Submitting Coveralls data to API
[INFO] Successfully submitted Coveralls data in 5872ms for Job #15.1

I do use oraclejdk8 (https://github.com/ksu-cis-501/cis501-helloworld/blob/master/.travis.yml); I'm not sure if this is the cause or there is some other misconfiguration issue.

Thanks,
Robby

Error on execute

I config my pom.xml equal to readme and it's not working

[INFO] Building Module Name
[INFO] task-segment: coveralls:cobertura
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.eluder.coveralls:coveralls-maven-plugin:2.0.0

Cause: Class 'java.util.List' cannot be instantiated
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.eluder.coveralls:coveralls-maven-plugin. Reason: Unable to parse the created DOM for plugin configuration
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:723)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginConfigurationException: Error configuring: org.eluder.coveralls:coveralls-maven-plugin. Reason: Unable to parse the created DOM for plugin configuration
at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1363)
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:724)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Class 'java.util.List' cannot be instantiated
at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.instantiateObject(AbstractConfigurationConverter.java:121)
at org.codehaus.plexus.component.configurator.converters.composite.CollectionConverter.fromConfiguration(CollectionConverter.java:73)
at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1357)
... 20 more
Caused by: java.lang.InstantiationException: java.util.List
at java.lang.Class.newInstance(Class.java:359)
at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.instantiateObject(AbstractConfigurationConverter.java:111)
... 25 more

Provide failOnError attribute

Hi there,
I have the following project:

  • parent
    • module1
    • module2
    • module3

and I have configured the maven surefire AND failsafe plugins to produce results in each of the module's target folder. So to run the build I run the following in the parent folder:

mvn clean install coveralls:report -Ptest

which cleans (with success), builds(with success), executes tests(with success), generates jacoco reports(with success) in each module and then it starts executing the coveralls:report but it fails because parent has no source, no tests and hence no jacoco.xml so the coveralls plugin complains with the following:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.1:report (default-cli) on project platform: I/O operation failed: No coverage report files found -> [Help 1]

here's the stacktrace:
Caused by: java.io.IOException: No coverage report files found
at org.eluder.coveralls.maven.plugin.util.CoverageParsersFactory.createParsers(CoverageParsersFactory.java:101)
at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.createCoverageParsers(CoverallsReportMojo.java:231)
at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:196)

I'd like to have an attribute like 'failOnError' maybe which can be set to true or false. This way if jacoco.xml was not found the build will continue to the next modules instead of failing.

Remove url based source loading

Url based source loading cannot be applied due to changes in Coveralls behavior. The file names must match names in the git repository and external mapping, like Jasmine server, cannot be used to handle for example CoffeeScript files.

Integration question

Hi @trautonen,

Thanks for your work on this.
I'm one of the maintainers of the golang plugin for IntelliJ IDEA which is written in Java. As we'd like to have this up and running I've took a look at this but I couldn't figure out how we can use it for our particular project.
Do you have any hints on it?
Thank you for your time and help.

Kind regards

Generated sources

When running my

after_success:
  - mvn clean cobertura:cobertura coveralls:cobertura

I get error of missing HelpMojo.java. My project is a maven plugin and HelpMojo is a generated resource by the maven-plugin-plugin. For some reason coveralls plugin fails to find it.

Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:2.0.1:cobertura (default-cli) on project drm-parent: Build error: Could not find source file com/nitorcreations/HelpMojo.java from any source directory -> [Help 1]

Project I'm working on is https://github.com/NitorCreations/DomainReverseMapper if that helps in debugging.

coverage report file not found

I have a setup with parent pom.xml with no source and modules with coverage files. Plugin fails to find coverage files with this error:

mvn clean cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.0:report (default-cli) on project nfsdb: I/O operation failed: No coverage report
files found -> [Help 1]

jacoco multimodule question.

Hi there,

I'm trying to use your plugin, and from what I read on the site:

You can use JaCoCo in a multi-module project so that all modules run JaCoCo separately and let the plugin aggregate the report

well I tried this one. I have a multi-module project setup like this:

parent (no tests, no coverage)
    |---- module1 (tests and coverage reports)
    |---- module2 (no tests no coverage reports)
    |---- module 3 (tests and coverage reports)

So what I do is I run maven from the parent project to run all my unit and integration tests and some of the modules produce results. Then after build is complete and jacoco has produced reports in some of the modules, I run maven again like this:

mvn coveralls:report

again from the parent project. However the build fails with the following error:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.1:report (default-cli) on project platform: I/O operation failed: No coverage report files found -> [Help 1]

This happens because the parent has no tests and no coverage reports. How can I can have the coveralls-maven-plugin aggregate all the reports from my modules and send it to coveralls?

Thank you

problem with multiple module project

Greetings,

I'm having trouble with a multiple module project. My two submodules are packaged as jar and as such have jacoco reports. My parent module is packaged as pom though, so it does not have a jacoco report. The maven coveralls plugin fails because it can not find the jacoco report for the parent project. Please advise.

If there is a better place to seek support for this issue please let me know.

Thank you very much,

-louis

no Cobertura.xml generated.

I copied the Cobertura-configuration code into my pom.xml and run mvn cobertura:cobertura. It seems to start cobertura, but no output file is generated:

...
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Library-Example 0.1-alpha-1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> cobertura-maven-plugin:2.6:cobertura (default-cli) @ Library-Example >>>
[INFO] 
[INFO] --- wro4j-maven-plugin:1.4.6:run (default) @ Library-Example ---
[INFO] Executing the mojo: 
...

Source not found

I am trying to build http://github.com/dresden-ocl/dresdenocl repository. But if I run mvn cobertura:cobertura coveralls:report cobertura runs fine. But coveralls-maven-plugin reports a problem:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.1:report (default-cli) on project org.dresdenocl: I/O operation failed: No source found for testpackage/Class1_DefAspect_testSortedByIteratorExp01.aj -> [Help 1]

The file in question lies in /tests/org.dresdenocl.tools.codegen.ocl2java.test.aspectj/src/testpackage/constraints so I really ask me why it is not looking into testpackage/constraints/ but in testpackage/.

Tried adding the directory to sourceDirectory but this does not help.

As you can see it is a multi module setup. Maybe you see where the problem comes from.

Can not appear to get these working with CodeShip

Hello. I was attempting to use this plugin in conjunction with Codeship and it appears to not be sending the final report. The following is at the bottom of my Maven build:

[INFO] Using repository token <secret>
[INFO] Git commit c553f4e in c553f4e6db97186733c7ef42179136c63f11a431
[INFO] Writing Coveralls data to /home/rof/clone/target/coveralls.json from coverage      report /home/rof/clone/target/site/cobertura/coverage.xml
[INFO] Successfully wrote Coveralls data in 358ms
[INFO] Submitting Coveralls data to API
[INFO] Successfully submitted Coveralls data in 1589ms for Job #3.1
[INFO] https://coveralls.io/jobs/210049
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.348s
[INFO] Finished at: Fri Jun 28 23:36:23 UTC 2013
[INFO] Final Memory: 25M/823M
[INFO] ------------------------------------------------------------------------

The report that is submitted is essentially blank. Full details of the build is available here.

Duplicate source files on Cobertura aggregate mode

When running Cobertura with aggregation mode set, it will generate per module reports also. There is no way the Coveralls plugin can tell if the file is an aggregate report or a non aggregate report. This can be addressed by tracking the source files added and ignore if there are duplicates.

JaCoCo report not found when not in default location

In my pom.xml, I set JaCoCo reports to be generated in a custom location:

<plugin>
  <groupId>org.jacoco</groupId>
  <artifactId>jacoco-maven-plugin</artifactId>
  <version>0.7.2.201409121644</version>
  <configuration>
    <outputDirectory>${project.reporting.outputDirectory}/${project.version}/jacoco</outputDirectory>
  </configuration>
</plugin>

I also configured coveralls-maven-plugin to add the report in the same custom location:

<plugin>
  <groupId>org.eluder.coveralls</groupId>
  <artifactId>coveralls-maven-plugin</artifactId>
  <version>3.0.1</version>
  <configuration>
    <jacocoReports>
      <param>${project.reporting.outputDirectory}/${project.version}/jacoco</param>
    </jacocoReports>
  </configuration>
</plugin>

I get the following error:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:3.0.1:report (default-cli) on project uncommons-dbutils: I/O operation failed: No coverage report files found -> [Help 1]

I am working around it by generating the JaCoCo report in the default location, but it would be great if non-default locations worked, too.

Ignore inner class identifiers in file names

Coveralls tries to fetch source files by name and inner class identifiers used in file name result an unfetchable file. At the moment there is no fix for this issue. Coveralls might need to provide two fields in the api, one field for the github file and one to show in Coveralls.

Validation of the Coveralls job

Coveralls Job must be set with some properties or with some property combinations to work correctly. Add validation to fail fast on misconfiguration and add proper error messages to aid user to fix the configuration.

Scoverage support

Would be nice to work with scoverage-maven-plugin or have an example in the README

Error: Failed to submit Coveralls data

Our private maven project cannot submit data when built in the Travis-CI environment. The error is:

[INFO] Submitting Coveralls data to API
[ERROR] Failed to submit Coveralls data in 1988ms

Running the same maven command locally does work. The project has a .coveralls.yml file with the token. I tried passing it on the command line too.

Is there anything else I can add to aid debugging?

Report submission to Coveralls API failed with HTTP status 422

Hi !

Thank you for your plugin, it sounds great :). But I have a problem.

I'm using travis CI and coveralls for a projec, both in free version. My projet is written in JAVA and uses Maven.

I get the error Processing of input or output data failed: Report submission to Coveralls API failed with HTTP status 422: Unprocessable Entity (Couldn't find a repository matching this job.). You can see the build there.

My pom.xml :

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <outputDirectory>${basedir}/target</outputDirectory>
            <format>xml</format>
            <maxmem>256m</maxmem>
            <!-- aggregated reports for multi-module projects -->
            <aggregate>true</aggregate>
        </configuration>
    </plugin>


    <plugin>
        <groupId>org.eluder.coveralls</groupId>
        <artifactId>coveralls-maven-plugin</artifactId>
         <version>3.0.1</version>

        <configuration>
            <coberturaReports>
                <coberturaReport>
                    ${basedir}/target/coverage.xml
                </coberturaReport>
            </coberturaReports>
            <sourceEncoding>UTF-8</sourceEncoding>
            <serviceName>travis-ci</serviceName>
            <serviceJobId>${env.TRAVIS_JOB_ID} </serviceJobId>
        </configuration>
    </plugin>

I use coveralls in it's free version. Why coveralls cannot get my build ?

Thanks

Why is a Token needed?

Hi Tapio,

I was wondering why does your plugin require a token of my github account. I thought all the plugin did was gather the jacoco/cobertura results and push them to coveralls server, but I'm probably missing something.
What do you do with the password? is it used only by the plugin? is it passed on to coveralls?
Maybe this could be in the FAQ?

Also, i found the way to generate a token for my whole account, is there a way to generate one in a per-repo basis instead? I see per-repo "deploy keys" in github, but in your readme you talk about Tokens so i don't know if a deploy key would work

Thanks for the plugin!

Alejandro

Filter out remote name from branch

At least Jenkins seems to add remote name to branch, and that will break the links in Coveralls. Scanning possible remotes and removing any remote from the branch name fixes the issue. Reported in #21.

Build error: Null charset name

I'm trying to integrate my Java project with coveralls and cobertura using your plugin but get the following error:

Build error: Null charset name

I've followed the instructions in the documentation, adding the cobertura-maven-plugin and coveralls-maven-plugin running the mvn clean cobertura:cobertura coveralls:cobertura command.

The project can be found here: https://github.com/BoyCook/MovieService and the build here https://travis-ci.org/BoyCook/MovieService/builds

Coveralls

Hi, thanks for your plugin!

I've tried your plugin for my graphhopper project. I started with cobertura but nothing happens:
https://travis-ci.org/graphhopper/graphhopper/jobs/8633626

I also tried jacoco but it says:
[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:1.1.0:jacoco (default-cli) on project graphhopper: IO operation failed: /home/travis/build/graphhopper/graphhopper/core/target/site/jacoco/jacoco.xml (No such file or directory) -> [Help 1](the same error message I get when trying it locally)
See https://travis-ci.org/graphhopper/graphhopper/jobs/8634425

Probably I've failed to understand how to configure the named plugins ... do you have a tip? I've looked at how you did it with https://github.com/trautonen/jersey-mustache but probably have missed something

Also which do you prefer - cobertura or jacoco?

NullPointerException: charset

When using version 2.2.0 on travis, I get a java.lang.NullPointerException: charset while submitting:

...
Caused by: java.lang.NullPointerException: charset
at java.io.InputStreamReader.<init>(InputStreamReader.java:115)
at org.eluder.coveralls.maven.plugin.httpclient.CoverallsClient.parseResponse(CoverallsClient.java:97)
at org.eluder.coveralls.maven.plugin.httpclient.CoverallsClient.submit(CoverallsClient.java:89)
at org.eluder.coveralls.maven.plugin.AbstractCoverallsMojo.submitData(AbstractCoverallsMojo.java:307)
at org.eluder.coveralls.maven.plugin.AbstractCoverallsMojo.execute(AbstractCoverallsMojo.java:192)

Is it possible that contentType() becomes null, because the server returns something without proper charset, and you dont check for such case?

"peer not authenticated" for OpenJDK 7 under TravisCI

I noticed you've already encountered this issue, mentioned in the comments in #15 (relevant comment). I've also encountered the issue, so I think it could probably use its own discussion thread.

See here for another build failure example.

Is this something that can be worked around by running a command of some sort before execution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.