Maven surefire显示错误java.lang.ClassNotFoundException:org.apache.xmlbeans.XmlObject

时间:2019-08-23 13:14:31

标签: java maven testing automated-tests apache-poi

到处都说该错误是由于缺少 xmlbeans 而引起的,但在我的依赖项中已指出该错误。

[ERROR] script3(script_1_2_3.TestScripts)  Time elapsed: 33.818 s  <<< ERROR!
java.io.IOException: org/apache/xmlbeans/XmlException
       at script_1_2_3.TestScripts.script3(TestScripts.java:84)
Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
       at script_1_2_3.TestScripts.script3(TestScripts.java:84)
Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
       at script_1_2_3.TestScripts.script3(TestScripts.java:84)

这是POM文件中这些apache.poi依赖项的完整列表。

            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>4.1.0</version>

            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.0</version>

            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>4.1.0</version>

            <groupId>org.apache.poi</groupId>
            <artifactId>ooxml-schemas</artifactId>
            <version>1.4</version>

            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>3.1.0</version>

            <groupId>org.apache.poi</groupId>
            <artifactId>poi-scratchpad</artifactId>
            <version>4.1.0</version>

此外,在开始测试之前,会出现适用于所有poi软件包的警告消息,但测试会运行。

[WARNING] The POM for org.apache.poi: poi:jar:4.1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.poi: poi-ooxml:jar:4.1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.poi: poi-ooxml-schemas:jar:4.1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.xmlbeans:xmlbeans:jar:3.1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.poi: poi-scratchpad:jar:3.9 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.poi: openxml4j:jar:1.0-beta is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

0 个答案:

没有答案