【问题标题】:Why does console keeps saying "uber-jar-6.5.5 seems corrupted"为什么控制台一直说“uber-jar-6.5.5 似乎已损坏”
【发布时间】:2021-10-05 18:00:12
【问题描述】:

我正在使用此命令 (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>

【问题讨论】:

  • 尝试使用 --verbose 标志运行 maven,这应该会告诉您更多信息。

标签: aem pom.xml


【解决方案1】:

尝试删除您的本地 ~/.m2 存储库,然后重试。

【讨论】:

    【解决方案2】:

    为什么控制台一直说“uber-jar-6.5.5 似乎已损坏”

    这会说因为文件已损坏......或者根本不是 JAR 文件。

    查看(假定的)JAR 文件中的实际内容:

    • 使用jar -tvf &lt;pathname&gt; 列出索引。这应该会告诉您文件是否损坏等。

    • 在 linux 上,使用file &lt;pathname&gt; 来尝试确定它到底是什么文件类型。

    • 如果是文本,请使用文本编辑器查看。

    (我的猜测是文件没有正确下载。我的第二个猜测是你实际上有一个HTML文档,其中包含来自失败下载的错误消息。如果是这种情况,应该有一些线索关于下载失败原因的错误消息。)

    【讨论】:

    • 这个没试过,成功了再回这个评论
    【解决方案3】:

    看看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

    【讨论】:

    • 已经试过了,还是报同样的错误
    【解决方案4】:

    我找到了解决此问题的替代解决方案。我使用 Eclipse neon 而不是通常的 eclipse 和 intellij。除了我之前在 Intellij 和 eclipse 上编译的项目之外,新创建的项目现在可以工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-23
      • 2020-03-18
      • 1970-01-01
      • 2021-12-10
      • 2016-05-27
      • 2013-07-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多