我正在使用样本 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
答案 0 :(得分: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