【问题标题】:trying to create jar file but have some errors试图创建 jar 文件但有一些错误
【发布时间】:2016-10-02 06:39:20
【问题描述】:

我下载了this repository from GitHub,做了一些修改。现在我想在 Heroku 上部署它。但是当我尝试制作 jar 文件时,我遇到了一些错误。也许有人知道问题出在哪里以及如何解决?

    [INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building java-blog-aggregator-boot 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jba ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 76 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jba ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jba ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ jba ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ jba ---
[INFO] Surefire report directory: C:\Users\Username\Desktop\java-blog-aggregator-boot-master\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running cz.jiripinkas.jba.service.AllTests
16:18:13,179 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
16:18:13,179 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
16:18:13,179 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Users/Username/Desktop/java-blog-aggregator-boot-master/target/classes/logback.xml]
16:18:13,331 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
16:18:13,353 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
16:18:13,397 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
16:18:13,602 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
16:18:13,602 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
16:18:13,602 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
16:18:13,603 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
16:18:13,607 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
16:18:13,660 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
16:18:13,663 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern debug.%d{yyyy-MM-dd}.%i.log for the active file
16:18:13,670 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4d3167f4 - The date pattern is 'yyyy-MM-dd' from file name pattern 'debug.%d{yyyy-MM-dd}.%i.log'.
16:18:13,670 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4d3167f4 - Roll-over at midnight.
16:18:13,820 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4d3167f4 - Setting initial period to Thu Jun 02 16:17:02 EEST 2016
16:18:13,825 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: debug.log
16:18:13,825 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [debug.log]
16:18:13,827 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
16:18:13,827 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
16:18:13,828 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
16:18:13,828 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
16:18:13,829 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@ed9d034 - Registering current configuration as safe fallback point

Tests run: 21, Failures: 5, Errors: 0, Skipped: 0, Time elapsed: 4.003 sec <<< FAILURE! - in cz.jiripinkas.jba.service.AllTests
testGetItemsFileJavaVids(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.189 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<23 03 2014 [09]:01:34> but was:<23 03 2014 [10]:01:34>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileJavaVids(RssServiceTest.java:59)

testGetItemsFileHibernate(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.392 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<04 04 2014 1[7]:20:32> but was:<04 04 2014 1[8]:20:32>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileHibernate(RssServiceTest.java:84)

testGetItemsFileSpring(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.475 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<07 04 2014 1[0]:14:00> but was:<07 04 2014 1[1]:14:00>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileSpring(RssServiceTest.java:70)

testGetRssDate(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.002 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<Sun Mar 23 [09:01:34 C]ET 2014> but was:<Sun Mar 23 [10:01:34 E]ET 2014>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetRssDate(RssServiceTest.java:120)

testGetItemsFileInstanceofJavaPublishedDate(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 1.005 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<22 02 2015 1[3]:35:00> but was:<22 02 2015 1[4]:35:00>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileInstanceofJavaPublishedDate(RssServiceTest.java:184)

Running cz.jiripinkas.jba.service.BlogServiceTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in cz.jiripinkas.jba.service.BlogServiceTest
Running cz.jiripinkas.jba.service.ItemServiceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in cz.jiripinkas.jba.service.ItemServiceTest
Running cz.jiripinkas.jba.service.RssServiceTest
Tests run: 18, Failures: 5, Errors: 0, Skipped: 0, Time elapsed: 0.979 sec <<< FAILURE! - in cz.jiripinkas.jba.service.RssServiceTest
testGetItemsFileJavaVids(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.001 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<23 03 2014 [09]:01:34> but was:<23 03 2014 [10]:01:34>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileJavaVids(RssServiceTest.java:59)

testGetItemsFileHibernate(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.108 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<04 04 2014 1[7]:20:32> but was:<04 04 2014 1[8]:20:32>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileHibernate(RssServiceTest.java:84)

testGetItemsFileSpring(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.249 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<07 04 2014 1[0]:14:00> but was:<07 04 2014 1[1]:14:00>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileSpring(RssServiceTest.java:70)

testGetRssDate(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.001 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<Sun Mar 23 [09:01:34 C]ET 2014> but was:<Sun Mar 23 [10:01:34 E]ET 2014>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetRssDate(RssServiceTest.java:120)

testGetItemsFileInstanceofJavaPublishedDate(cz.jiripinkas.jba.service.RssServiceTest)  Time elapsed: 0.443 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<22 02 2015 1[3]:35:00> but was:<22 02 2015 1[4]:35:00>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileInstanceofJavaPublishedDate(RssServiceTest.java:184)

Running cz.jiripinkas.jba.service.scheduled.ScheduledTasksServiceTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.141 sec - in cz.jiripinkas.jba.service.scheduled.ScheduledTasksServiceTest

Results :

Failed tests: 
cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileHibernate(cz.jiripinkas.jba.service.RssServiceTest)
  Run 1: RssServiceTest.testGetItemsFileHibernate:84 expected:<04 04 2014 1[7]:20:32> but was:<04 04 2014 1[8]:20:32>
  Run 2: RssServiceTest.testGetItemsFileHibernate:84 expected:<04 04 2014 1[7]:20:32> but was:<04 04 2014 1[8]:20:32>

cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileInstanceofJavaPublishedDate(cz.jiripinkas.jba.service.RssServiceTest)
  Run 1: RssServiceTest.testGetItemsFileInstanceofJavaPublishedDate:184 expected:<22 02 2015 1[3]:35:00> but was:<22 02 2015 1[4]:35:00>
  Run 2: RssServiceTest.testGetItemsFileInstanceofJavaPublishedDate:184 expected:<22 02 2015 1[3]:35:00> but was:<22 02 2015 1[4]:35:00>

cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileJavaVids(cz.jiripinkas.jba.service.RssServiceTest)
  Run 1: RssServiceTest.testGetItemsFileJavaVids:59 expected:<23 03 2014 [09]:01:34> but was:<23 03 2014 [10]:01:34>
  Run 2: RssServiceTest.testGetItemsFileJavaVids:59 expected:<23 03 2014 [09]:01:34> but was:<23 03 2014 [10]:01:34>

cz.jiripinkas.jba.service.RssServiceTest.testGetItemsFileSpring(cz.jiripinkas.jba.service.RssServiceTest)
  Run 1: RssServiceTest.testGetItemsFileSpring:70 expected:<07 04 2014 1[0]:14:00> but was:<07 04 2014 1[1]:14:00>
  Run 2: RssServiceTest.testGetItemsFileSpring:70 expected:<07 04 2014 1[0]:14:00> but was:<07 04 2014 1[1]:14:00>

cz.jiripinkas.jba.service.RssServiceTest.testGetRssDate(cz.jiripinkas.jba.service.RssServiceTest)
  Run 1: RssServiceTest.testGetRssDate:120 expected:<Sun Mar 23 [09:01:34 C]ET 2014> but was:<Sun Mar 23 [10:01:34 E]ET 2014>
  Run 2: RssServiceTest.testGetRssDate:120 expected:<Sun Mar 23 [09:01:34 C]ET 2014> but was:<Sun Mar 23 [10:01:34 E]ET 2014>


Tests run: 41, Failures: 5, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.344 s
[INFO] Finished at: 2016-06-02T16:18:18+03:00
[INFO] Final Memory: 21M/268M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project jba: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\Users\Username\Desktop\java-blog-aggregator-boot-master\target\surefire-reports for the individual test results.
[ERROR] -> [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

【问题讨论】:

  • 您是否查看了cz.jiripinkas.jba.service.AllTests 源中提到的test... 方法中的日期/时间比较?
  • 我在这里发布了测试文件。可以查一下吗?
  • 我遇到了同样的问题,你是怎么解决的
  • 我也无法在此应用程序中创建新博客

标签: java maven heroku jar spring-boot


【解决方案1】:

您的单元测试似乎失败了,这将导致 maven 构建失败。您可以在运行 maven 构建时跳过测试,或者做正确的事情并修复单元测试。他们似乎因为某个日期而失败了?

【讨论】:

  • 如何跳过测试?
  • mvn -DskipTests=true clean package 但是如果有失败的测试,应用程序可能会在启动时失败..仅供参考。
  • 然后我跳过测试我终于创建了 jar 文件。但是当我在 heroku 上部署它时,应用程序无法正常工作。只是显示错误 应用程序错误 应用程序发生错误,无法提供您的页面。请稍后重试。如果您是应用程序所有者,请查看您的日志以了解详细信息。
  • 日志 - 2016-06-02T16:33:46.487714+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= rssnewsreaderr.herokuapp.com request_id=5ba1e1d9-d801-4fef-8248-e052fb8ad523 fwd="185.138.228.230" dyno= connect= service= status=503 bytes=
  • 通常跳过测试不是一个好习惯。进行测试以向您显示代码中的错误,因此代码本身可能存在问题。你知道为什么你的测试失败了吗?
猜你喜欢
  • 2013-07-08
  • 2016-11-07
  • 1970-01-01
  • 2022-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-12
  • 1970-01-01
相关资源
最近更新 更多