maven2 中的编译错误:“无效的 CEN 标头(签名错误)”

2022-09-01 10:36:37

我正在迁移我们的java-ee项目,以使用Maven而不是Ant。

对于以下依赖项

    <dependency>
      <groupId>javolution</groupId>
      <artifactId>javolution</artifactId>
      <version>5.4.2</version>
    </dependency>

我在尝试编译时收到以下错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (default-compile) on project JAdaptiv: Compilation failure
[ERROR] error: error reading C:\Users\User.IVSTEL1\.m2\repository\javolution\
javolution\5.4.2\javolution-5.4.2.jar; invalid CEN header (bad signature)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on
 project JAdaptiv: Compilation failure
error: error reading C:\Users\User.IVSTEL1\.m2\repository\javolution\javoluti
on\5.4.2\javolution-5.4.2.jar; invalid CEN header (bad signature)

        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
ure
error: error reading C:\Users\Croydon.IVSTEL1\.m2\repository\javolution\javoluti
on\5.4.2\javolution-5.4.2.jar; invalid CEN header (bad signature)

        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
Mojo.java:656)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        ... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

答案 1

这意味着本地存储库中的 javolution-5.4.2 jar 已损坏。我在此链接上检查了5.4.2版本的maven存储库。您可以手动将jar从那里复制到本地存储库,以查看是否有帮助。

您也可以尝试以下步骤:-

  1. 从本地存储库中删除 jar。然后maven会再次为您下载它。C:\Users\User.IVSTEL1\.m2\repository\javolution\ javolution\5.4.2\javolution-5.4.2.jar
  2. 如果重新下载后5.4.2版本仍然存在一些问题,请尝试以下版本

    <dependency> <groupId>javolution</groupId> <artifactId>javolution</artifactId> <version>5.5.1</version> </dependency>


答案 2

我为解决此问题而遵循的步骤:

第 1 步:从 .m2->存储库文件夹中删除了 jar

第 2 步:从 Java 构建路径>图书馆中删除 maven 依赖项

第3步:右键单击项目>maven->更新项目


推荐