2011-03-27 87 views
17

我遷移我們的Java EE項目使用Maven代替螞蟻。編譯錯誤的maven2:「無效的CEN頭(錯誤簽名)」

對於下面的依賴

<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 

回答

36

這意味着javolution-5.4.2罐子在你的本地庫已損壞時。我檢查了行家回購的5.4.2版本上這個link。您可以手動將jar從那裏複製到本地存儲庫,以查看是否有幫助。

您也可以嘗試以下步驟: -

  1. 從本地資源庫C:\Users\User.IVSTEL1\.m2\repository\javolution\ javolution\5.4.2\javolution-5.4.2.jar刪除罐子。然後Maven會再次爲你下載它。
  2. 如果5.4.2版重新下載後,仍然有一些問題,那麼請嘗試以下version

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

+1

這將工作過。在此期間,我最終建立一個[Maven倉庫管理(http://nexus.sonatype.org/)的管理,以獲取正確的文件。 – 2011-03-28 23:52:36

+0

是,如果有託管關係或artifactory的類似回購經理的能力那麼這是理想的解決方案。 – CoolBeans 2011-03-29 00:52:33