如何解决为什么控制台总是说“uber-jar-6.5.5 似乎已损坏”
我正在使用此命令 (mvn clean install -PautoInstall) 将我的项目从 IntelliJ 安装到 aem,但我一直遇到此错误
JAR/ZIP 文件 (C:\Users....m2\repository\com\adobe\aem\uber-jar\6.5.5\uber-jar-6.5.5.jar) 似乎已损坏,错误:打开 zip 文件时出错
我已经尝试删除和下载 uber-jar,但无济于事。
这是我的核心 Pom.xml
4.0.0 com.startsite 起点 1.0-快照 ../pom.xml
<artifactId>startsite.core</artifactId>
<packaging>bundle</packaging>
<name>Start Site - Core</name>
<description>Core bundle for Start Site</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.Felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<!-- Import any version of javax.inject,to allow running on multiple versions of AEM -->
<Import-Package>javax.inject;version=0.0.0,*</Import-Package>
<Sling-Model-Packages>
com.startsite.core
</Sling-Model-Packages>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Osgi Dependencies -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
</dependency>
<!-- Other Dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<classifier>apis</classifier>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.5.5</version>
</dependency>
<dependency>
<groupId>com.day.commons</groupId>
<artifactId>day.commons.datasource.poolservice</artifactId>
<version>1.0.10</version>
</dependency>
</dependencies>
解决方法
尝试删除您的本地 ~/.m2 存储库,然后重试。
,为什么控制台总是说“uber-jar-6.5.5 似乎已损坏”
它会说因为文件已损坏...或者根本不是 JAR 文件。
看看(假定的)JAR 文件中的实际内容:
-
使用
jar -tvf <pathname>
列出索引。这应该会告诉您文件是否已损坏等。 -
在 linux 上,使用
file <pathname>
来尝试确定它到底是什么文件类型。 -
如果是文本,请使用文本编辑器查看。
(我的猜测是该文件没有正确下载。我的第二个猜测是您实际拥有的是一个 HTML 文档,其中包含来自失败下载的错误消息。如果是这种情况,应该有一些线索关于下载失败原因的错误消息。)
,看看pom。我看到 uber-jar 声明了两次,删除了第一个,只保留了一个带有版本的。此外,uber-jar 应该具有提供的范围:
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.5.8</version>
<scope>provided</scope>
</dependency>
然后,从您的 m2 文件夹中删除 uber-jar 并执行 mvn -U clean install -PautoInstall
我找到了解决此问题的替代解决方案。我使用 Eclipse neon 而不是通常的 eclipse 和 intellij。除了我之前在 Intellij 和 eclipse 上编译的项目之外,新创建的项目现在可以工作了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。