trautonen / coveralls-maven-plugin

Maven plugin for submitting Java code coverage reports to Coveralls web service.
MIT License
312 stars 123 forks source link

Unable to parse timestamp "1451264796995": Unparseable date: "1451264796995" #90

Open fabriziogiudici opened 8 years ago

fabriziogiudici commented 8 years ago

Hello.

Perhaps it's just me, I'm trying the plugin for the first time, but I get the error in the subject. The stack dump is:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:4.1.0:report (default-cli) on project solidblue2: Processing of input or output data failed: Unable to parse timestamp "1451264796995": Unparseable date: "1451264796995" -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:4.1.0:report (default-cli) on project solidblue2: Processing of input or output data failed at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 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:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 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.MojoFailureException: Processing of input or output data failed at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:247) 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: org.eluder.coveralls.maven.plugin.ProcessingException: Unable to parse timestamp "1451264796995" at org.eluder.coveralls.maven.plugin.util.TimestampParser.parse(TimestampParser.java:62) at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.createJob(CoverallsReportMojo.java:312) at org.eluder.coveralls.maven.plugin.CoverallsReportMojo.execute(CoverallsReportMojo.java:228) ... 21 more Caused by: java.text.ParseException: Unparseable date: "1451264796995" at java.text.DateFormat.parse(DateFormat.java:366) at org.eluder.coveralls.maven.plugin.util.TimestampParser.parse(TimestampParser.java:60) ... 23 more

And the command line I'm trying to do is:

mvn -clean install jacoco:report coveralls:report -Pit.tidalwave-metrics-v2

(the specified profile activates jacoco as needed).

I suppose I'd get some authentication error with Coverall, but it seems that something fails earlier.

It can be reproduced with a tiny project of mine at GitHub:

github.com:tidalwave-it/solidblue2-src.git

in the branch named 'fabrizio.giudici'.

trautonen commented 8 years ago

I think this feature is not documented as well as it should. The plugin tries to fetch build timestamp information from maven and by default it uses the property ${maven.build.timestamp} which by default should be in ${maven.build.timestamp.format} format.

Your case seems to be that you are using non default build timestamp format, which causes the plugin to fail. Your timestamp looks like epoch millis. The plugin can use custom timestamp format, but it must be in format supported by SimpleDateFormat. And epoch millis unfortunately is not.

Are you using some custom plugin or filtering to change the build timestamp? As far as I know, Maven uses also SimpleDateFormat so your format is not internally supported by Maven either. To resolve your issue with current features, you could try to change your build timestamp format if that is possible. The plugin uses properties timestamp and timestampFormat to resolve the timestamp of the build.

Created also a new issue to support epoch timestamps: #91

dtracers commented 8 years ago

I am also having this issue. Was a solution found to this issue?

trautonen commented 8 years ago

@dtracers there is new feature that allows you to configure the plugin to use epoch timestamps for build time. Set <timestampFormat>EpochMillis</timestampFormat> in plugin configuration.

This feature is not yet in a release version, but it would be great that someone with this issue could verify it works. You can use the 4.2.0-SNAPSHOT version from Sonatype's repository.

emmanuel-keller commented 8 years ago

@trautonen It works. I got the same issue:

[ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:4.1.0:report (default-cli) on project qwazr-parent: Processing of input or output data failed: Unable to parse timestamp "1464514530890": Unparseable date: "1464514530890" -> [Help 1]

Solved with this configuration:

 <plugin>
      <groupId>org.eluder.coveralls</groupId>
      <artifactId>coveralls-maven-plugin</artifactId>
      <version>4.2.0-SNAPSHOT</version>
      <configuration>
           <timestampFormat>EpochMillis</timestampFormat>
      </configuration>
</plugin>

Successfully published here: https://coveralls.io/github/qwazr/QWAZR?branch=master