0

我正在使用来自 https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-cache的 示例 示例项目在我运行时使用

mvn spring-boot:run -Predis

但是,当我添加依赖项时

<dependency>
            <groupId>com.atlassian.connect</groupId>
            <artifactId>atlassian-connect-spring-boot-starter</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.connect</groupId>
            <artifactId>atlassian-connect-spring-boot-jpa-starter</artifactId>
            <version>1.3.5</version>
        </dependency>

我得到以下异常

java.lang.reflect.InvocationTargetException
        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:498)
        at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:557)
        at java.lang.Thread.run(Thread.java:748) Caused by: liquibase.exception.UnexpectedLiquibaseException: java.util.zip.ZipException: invalid LOC header (bad signature)
        at liquibase.servicelocator.ServiceLocator.setResourceAccessor(ServiceLocator.java:129)
        at liquibase.servicelocator.ServiceLocator.<init>(ServiceLocator.java:69)
        at liquibase.servicelocator.CustomResolverServiceLocator.<init>(CustomResolverServiceLocator.java:16)
        at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener$LiquibasePresent.replaceServiceLocator(LiquibaseServiceLocatorApplicationListener.java:56)
        at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener.onApplicationEvent(LiquibaseServiceLocatorApplicationListener.java:45)
        at org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener.onApplicationEvent(LiquibaseServiceLocatorApplicationListener.java:35)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
        at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68)
        at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137)
        at sample.cache.SampleCacheApplication.main(SampleCacheApplication.java:31)
        ... 6 more Caused by: java.util.zip.ZipException: invalid LOC header (bad signature)
        at java.util.zip.ZipFile.read(Native Method)
        at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
        at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:734)
        at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:434)
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at java.util.jar.Manifest$FastInputStream.fill(Manifest.java:441)
        at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:375)
        at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:409)
        at java.util.jar.Attributes.read(Attributes.java:376)
        at java.util.jar.Manifest.read(Manifest.java:199)
        at java.util.jar.Manifest.<init>(Manifest.java:69)
        at liquibase.servicelocator.ServiceLocator.setResourceAccessor(ServiceLocator.java:118)
        ... 20 more
4

1 回答 1

0

某些 JAR 无法使用 maven 正确下载,并且无法读取 JAR

您可以尝试找到有问题的 jar 并自己从.m2文件夹中删除它,或者只是运行mvn dependency:purge-local-repository以擦除所有内容然后重新编译,或者我个人更喜欢mvn install获取测试依赖项等。

依赖插件有更多选项可以使其更细粒度。

https://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html

于 2018-05-30T13:47:57.253 回答