【问题标题】:ClassFormatError - Surefire?ClassFormatError - 万无一失?
【发布时间】:2011-05-29 03:50:30
【问题描述】:

当我尝试部署工件时,我的项目确实有测试时收到 ClassFormatError:

[INFO] --- maven-surefire-plugin:2.5:test (default-test) @ ssh-exec ---
[INFO] Concurrency config is {threadCount=10, parallel=methods, configurableParallelComputerPresent=false}
[INFO] Surefire report directory: /home/walterjwhite/storage/projects/software/active/stable/task/impl/ssh-exec/target/surefire-reports
org.apache.maven.surefire.booter.SurefireExecutionException: Incompatible magic value 4022320623 in class file test-classes/com/walterjwhite/task/impl/ssh/exec/RemoteCommandExecutorTest; nested exception is java.lang.ClassFormatError: Incompatible magic value 4022320623 in class file test-classes/com/walterjwhite/task/impl/ssh/exec/RemoteCommandExecutorTest
java.lang.ClassFormatError: Incompatible magic value 4022320623 in class file test-classes/com/walterjwhite/task/impl/ssh/exec/RemoteCommandExecutorTest

还有其他人遇到过这个问题吗?

谢谢,

沃尔特

【问题讨论】:

    标签: java deployment surefire maven-3 jalopy


    【解决方案1】:

    有几个与不兼容的魔法值相关的链接——也许其中一个适用于这种情况。

    基本上类文件在某种程度上已损坏。

    Link 1 Link 2

    【讨论】:

    • 感谢您的链接,我之前偶然发现了它们;但是,我禁用了资源过滤、jalopy 格式和依赖项解包。奇怪的是,这个问题只发生在部署目标上。即使我运行测试(mvn clean test、mvn clean package、mvn clean install),这些都可以正常工作。只是部署阶段被破坏了。
    • 嗯,我注意到了一些奇怪的事情,我在目标目录中看到了递归。在 test-classes 文件夹中,有一个已构建的 jar,然后您将再次看到类,surefire ... 由于 surefire 使用类路径作为该目录,它是那些搞砸的类文件之一。这首先是怎么发生的?
    • 啊,一定是我的资源插件。它似乎再次被调用。
    • 好的,我找到了。我在父 pom 中配置了资源插件以过滤复制的资源。我知道我这样做是有原因的,但我现在不记得了。这对我来说似乎是一个基本问题 - 如果您的资源已经存在(项目已构建),那么如果要复制文件,资源插件不应该覆盖现有文件吗?
    猜你喜欢
    • 1970-01-01
    • 2019-04-25
    • 1970-01-01
    • 2012-12-24
    • 2010-10-24
    • 2012-11-29
    • 2012-09-16
    • 2016-01-25
    • 1970-01-01
    相关资源
    最近更新 更多