45429


Spring tool suiteでMaven install時にエラーが出てしまい、ビルドできず、どうすればよいのかわかりません。どうかお助けください。

[code]

    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building MyBootApp 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [WARNING] The POM for com.zaxxer:HikariCP:jar:2.7.9 is invalid, transitive dependencies (if any) will not be ava    ilable, enable debug logging for more details
    [INFO] 
    [INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ MyBootApp ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO] Copying 4 resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ MyBootApp ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 4 source files to C:\Users\yoshi\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\target\classes    
    [ERROR] C:\Users\yoshi\.m2\repository\org\springframework\spring-jdbc\5.0.6.RELEASE\spring-jdbc-5.0.6.RELEASE.ja    rの読込みエラーです。invalid LOC header (bad signature)
    [ERROR] C:\Users\yoshi\.m2\repository\org\hibernate\hibernate-core\5.2.17.Final\hibernate-core-5.2.17.Final.jar    の読込みエラーです。invalid LOC header (bad signature)
    [INFO] 
    [INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ MyBootApp ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory C:\Users\yoshi\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\src\te    st\resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ MyBootApp ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 1 source file to C:\Users\yoshi\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\target\test-cla    sses
    [ERROR] C:\Users\yoshi\.m2\repository\org\springframework\spring-jdbc\5.0.6.RELEASE\spring-jdbc-5.0.6.RELEASE.ja    rの読込みエラーです。invalid LOC header (bad signature)
    [ERROR] C:\Users\yoshi\.m2\repository\org\hibernate\hibernate-core\5.2.17.Final\hibernate-core-5.2.17.Final.jar    の読込みエラーです。invalid LOC header (bad signature)
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ MyBootApp ---
    [INFO] 
    [INFO] -------------------------------------------------------
    [INFO]  T E S T S
    [INFO] -------------------------------------------------------
    [INFO] Running com.kuwa.springboot.MyBootAppApplicationTests
    23:00:52.136 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRun    ner constructor called with [class com.kuwa.springboot.MyBootAppApplicationTests]
    (省略）
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.0.2.RELEASE)
    
    2018-07-08 23:00:55.375  INFO 24768 --- [           main] c.k.s.MyBootAppApplicationTests          : Starting My    BootAppApplicationTests on DESKTOP-2H6JNOI with PID 24768 (started by yoshi in C:\Users\yoshi\Documents\workspac    e-sts-3.9.2.RELEASE\MyBootApp)
    2018-07-08 23:00:55.380  INFO 24768 --- [           main] c.k.s.MyBootAppApplicationTests          : No active p    rofile set, falling back to default profiles: default
    2018-07-08 23:00:55.565  INFO 24768 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Refreshing     org.springframework.web.context.support.GenericWebApplicationContext@496bc455: startup date [Sun Jul 08 23:00:55     JST 2018]; root of context hierarchy
    2018-07-08 23:01:00.981  WARN 24768 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception e    ncountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.Unsatis    fiedDependencyException: Error creating bean with name 'heloController': Unsatisfied dependency expressed throug    h field 'repository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qu    alifying bean of type 'com.kuwa.springboot.repositories.MyDataRepository' available: expected at least 1 bean wh    ich qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Auto    wired(required=true)}
    2018-07-08 23:01:01.013  INFO 24768 --- [           main] ConditionEvaluationReportLoggingListener : 
    
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled    .
    2018-07-08 23:01:01.599 ERROR 24768 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
    
    ***************************
    APPLICATION FAILED TO START
    ***************************
    
    Description:
    
    Field repository in com.kuwa.springboot.HeloController required a bean of type 'com.kuwa.springboot.repositories    .MyDataRepository' that could not be found.
    
    
    Action:
    
    Consider defining a bean of type 'com.kuwa.springboot.repositories.MyDataRepository' in your configuration.
    
    2018-07-08 23:01:01.622 ERROR 24768 --- [           main] o.s.test.context.TestContextManager      : Caught exce    ption while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@7d    c0f706] to prepare test instance [com.kuwa.springboot.MyBootAppApplicationTests@69e308c6]
    
    java.lang.IllegalStateException: Failed to load ApplicationContext
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwa    reContextLoaderDelegate.java:125) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java    :108) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletT    estExecutionListener.java:190) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutio    nListener.java:132) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[sp    ring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:2    27) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunn    er.java:289) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]    
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:    291) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246    ) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)     [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
        at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClas    sCallbacks.java:61) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassC    allbacks.java:70) [spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [sp    ring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.21.0.    jar:2.21.0]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit    4-2.21.0.jar:2.21.0]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-    2.21.0.jar:2.21.0]
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.21.0.j    ar:2.21.0]
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379) [sur    efire-booter-2.21.0.jar:2.21.0]
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340) [surefire-booter-    2.21.0.jar:2.21.0]
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125) [surefire-booter-2.21.0.jar:    2.21.0]
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413) [surefire-booter-2.21.0.jar:2.2    1.0]
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helo    Controller': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframewor    k.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.kuwa.springboot.repositories.MyDa    taRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:     {@org.springframework.beans.factory.annotation.Autowired(required=true)}
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.i    nject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring    -beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValu    es(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowir    eCapableBeanFactory.java:1348) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowir    eCapableBeanFactory.java:578) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireC    apableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java    :317) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanR    egistry.java:228) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[s    pring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spr    ing-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultList    ableBeanFactory.java:760) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractAp    plicationContext.java:869) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:55    0) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.0.2.RELEAS    E.jar:2.0.2.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.0.2    .RELEASE.jar:2.0.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.2.RELEASE.ja    r:2.0.2.RELEASE]
        at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:13    9) ~[spring-boot-test-2.0.2.RELEASE.jar:2.0.2.RELEASE]
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(Default    CacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwa    reContextLoaderDelegate.java:117) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        ... 27 common frames omitted
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.kuwa    .springboot.repositories.MyDataRepository' available: expected at least 1 bean which qualifies as autowire candi    date. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultList    ableBeanFactory.java:1509) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableB    eanFactory.java:1104) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBea    nFactory.java:1065) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.i    nject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
        ... 45 common frames omitted
    
    [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.708 s <<< FAILURE! - in com.kuwa.spri    ngboot.MyBootAppApplicationTests
    [ERROR] contextLoads(com.kuwa.springboot.MyBootAppApplicationTests)  Time elapsed: 0.044 s  <<< ERROR!
    java.lang.IllegalStateException: Failed to load ApplicationContext
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helo    Controller': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframewor    k.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.kuwa.springboot.repositories.MyDa    taRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:     {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.kuwa    .springboot.repositories.MyDataRepository' available: expected at least 1 bean which qualifies as autowire candi    date. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
    
    [INFO] 
    [INFO] Results:
    [INFO] 
    [ERROR] Errors: 
    [ERROR]   MyBootAppApplicationTests.contextLoads ≫ IllegalState Failed to load Applicati...
    [INFO] 
    [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 25.612 s
    [INFO] Finished at: 2018-07-08T23:01:02+09:00
    [INFO] Final Memory: 34M/210M
    [INFO] ------------------------------------------------------------------------
    [WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on proj    ect MyBootApp: There are test failures.
    [ERROR] 
    [ERROR] Please refer to C:\Users\yoshi\Documents\workspace-sts-3.9.2.RELEASE\MyBootApp\target\surefire-reports f    or the individual test results.
    [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].    dumpstream.
    [ERROR] -> [Help 1]
    [ERROR] 
    
[/code]

pom.xml  
  
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
<http://maven.apache.org/xsd/maven-4.0.0.xsd>">  
4.0.0

[code]

        <groupId>com.kuwa.springboot</groupId>
        <artifactId>MyBootApp</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>jar</packaging>
    
        <name>MyBootApp</name>
        <description>Demo project for Spring Boot</description>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.0.2.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
    
            <!-- dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-jasper</artifactId>
            </dependency -->
    
            <!--  dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-groovy-templates</artifactId>
            </dependency-->
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-thymeleaf</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
                <scope>runtime</scope>
            </dependency>
    
    
    
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    
        </project>
    
[/code]


CC BY-SA 4.0
2018-07-08T14:23:52.783
45428
2018-07-08T15:49:46.217
23122
question
java spring spring-boot maven
Spring tool suiteでMaven installエラー (Spring boot)


すみません。こっちのエラーですね。

[code]

    > [ERROR]
    > C:\Users\yoshi\.m2\repository\org\springframework\spring-jdbc\5.0.6.RELEASE\spring-jdbc-5.0.6.RELEASE.jarの読込みエラーです。invalid
    > LOC header (bad signature) [ERROR]
    > C:\Users\yoshi\.m2\repository\org\hibernate\hibernate-core\5.2.17.Final\hibernate-core-5.2.17.Final.jarの読込みエラーです。invalid
    > LOC header (bad signature)
    
[/code]

[Mavenリポジトリのローカルキャッシュを削除で解決](https://qiita.com/ASHITSUBO/items/0d30c1ddf476d2ec96b7)
するという記事がありました。  
以下をお試しください。

> C:\Users\yoshi\.m2\repository 配下のフォルダを全て削除し、  
>  Mavenプロジェクト右クリック → Maven → Update Maven Project... からpom.xmlを反映し直す。


CC BY-SA 4.0
2018-07-08T14:36:50.227
45429
2018-07-08T15:49:46.217
2018-07-08T15:49:46.217
45428
answer