使用spring构建Web项目时如何修复MojoFailureException

2024-04-09

最近我使用spring STS和roo 1.2.0.M1来构建一个web项目。我设置了 jpa 并创建了一个具有某些字段的实体,并为该实体创建了一个存储库和一个服务层,然后当我执行测试时,它给出了以下错误:

roo> perform tests 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building WebApplication 0.1.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- aspectj-maven-plugin:1.2:compile (default) @ WebApplication ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ WebApplication ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ WebApplication ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- aspectj-maven-plugin:1.2:test-compile (default) @ WebApplication ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ WebApplication ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ WebApplication ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.8:test (default-test) @ WebApplication ---
[INFO] Surefire report directory: /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.936s
[INFO] Finished at: Fri Oct 28 20:59:59 EST 2011
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8:test (default-test) on project WebApplication: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我在终端中运行 mvn 测试,出现以下错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.614s
[INFO] Finished at: Fri Oct 28 21:06:50 EST 2011
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8:test (default-test) on project WebApplication: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8:test (default-test) on project WebApplication: There are test failures.

Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
    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.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.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(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:74)
    at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:644)
    at org.apache.maven.plugin.surefire.SurefirePlugin.executeAfterPreconditionsChecked(SurefirePlugin.java:640)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:103)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我使用以下命令来构建项目:

jpa setup --database MYSQL --provider HIBERNATE --databaseName App --hostName localhost --password root --persistenceUnit app --transactionManager appTransactionManager --userName root
entity --class ~.app.domain.DomainObjBaseModel --mappedSuperclass --persistenceUnit app --transactionManager appTransactionManager

// After running the above command, I manually add the following stuff in DomainObjBaseModel, because I don't know how to customise the roo auto generate stuff
    @Id @GeneratedValue(generator="system-uuid")
    @GenericGenerator(name="system-uuid", strategy = "uuid")
    @Column(unique = true, name = "id", nullable = false, length=32)
    private String id;
// After this action, I continue run the following commands.

entity --class ~.app.domain.Application --extends com.crazysoft.web.app.domain.DomainObjBaseModel --persistenceUnit app --transactionManager appTransactionManager --serializable --testAutomatically
repository jpa --interface ~.app.repository.ApplicationRepository --entity ~.app.domain.Application
service --interface ~.app.service.ApplicationService --entity ~.app.domain.Application

这是maven插件的配置:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>

完成上述工作后,然后运行perform tests通过STS roo shell,我得到了上述错误。

有谁知道为什么会出现这种异常?我做错了什么吗?以及如何修复它?

请帮我!

先感谢您!


一项或多项测试不起作用。

查看位于以下位置的文件:/Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports(通常较大的文件包含问题)

在那里您将找到测试结果以及已损坏的测试。该文件中包含的堆栈跟踪将指导您解决问题。

(顺便说一句:您也可以通过 JUnit 插件(Package explorer,右键单击,作为 JUnit 运行)在 eclipse 中运行测试,然后您将在 IDE 中看到堆栈跟踪,而无需在文件中搜索。)


我猜想,数据库连接不正确。但这只是一个猜测。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用spring构建Web项目时如何修复MojoFailureException 的相关文章

随机推荐

  • 页面上或 .js 脚本中是否可以有多个 jQuery 就绪事件?

    我注意到 jQuery 就绪事件和函数在我的大部分 JavaScript 中只使用了一次 但是 我想知道是否可以多次使用就绪事件 例如 是否可以在我的主 html 代码中的就绪事件函数调用中调用函数 然后在 js 文件中的另一个就绪事件函数
  • 在 Woocommerce 中下订单后,将值插入自定义表中

    我需要插入到我的自定义表中许可证表 username order id Quantity This needs to be populated when an order is placed Username customer s emai
  • 这段 1988 年的 C 代码有什么问题?

    我正在尝试编译 C 编程语言 K R 一书中的这段代码 它是 UNIX 程序的基本版本wc include
  • 尝试通过我的新域访问 WordPress with LiteSpeed 时显示 404

    我已经在 Digital Ocean Droplet 中创建了一个带有开放 LiteSpeed 缓存的 WordPress 实例 如果我在 设置 常规站点 和 WordPress URL 中配置了 IP 则它可以正常工作 但是当我添加我的
  • SQL:枚举每个组内返回的行

    假设我有一个SELECT 返回某物的查询 像这样 role name MANAGER Alice WORKER Bob WORKER Evan WORKER John MANAGER Max WORKER Steve 是否可以添加另一列来枚
  • 从 Git 存储库安装 Python 包后,某些文件夹丢失

    我想从以下存储库安装软件包https github com geomin django countria https github com geomin django countria 我正在使用的命令是pip install git gi
  • Xcode 存档调试条错误

    我正在尝试将大型遗留 C 库与 iOS 应用程序集成 我们能够在设备上构建并运行 但无法存档该应用程序 归档失败并出现以下错误 命令 Applications Xcode app Contents Developer Toolchains
  • 关闭依赖项的默认功能

    我有一个依赖链 最终依赖于可选地在已弃用的库上 具体来说 我想使用间接依赖于 rustc serialize 的 nalgebra 如下所示 nalgebra gt alga gt num complex gt 可选默认值 rustc se
  • 与多处理错误的另一个混淆是,“模块”对象没有属性“f”

    我知道之前已经回答过这个问题 但似乎直接执行脚本 python filename py 不起作用 我在 SuSE Linux 上安装了 Python 2 6 2 Code usr bin python coding utf 8 from m
  • Spark 作业在 YARN 模式下失败

    我有一个用 Scala 编写的 Spark 程序 它从 HDFS 读取 CSV 文件 计算新列并将其保存为 parquet 文件 我正在 YARN 集群中运行该程序 但每次我尝试启动它时 执行程序都会在某个时候失败并出现此错误 您能帮我找出
  • 如何验证nginx是否正在运行?

    After 运行 ASP NET vNext 项目 http xameeramir github io asp net 5 ubuntu linux 在我的本地机器上我试图弄清楚如何运行它nginx https www nginx com
  • 绑定 elementname 究竟是如何工作的?

    我记得几周前读过 它有时在模板内不起作用 我最近尝试在两个不同的窗口中绑定东西 但它找不到名称声明 所以我假设它是本地的命名空间类 只需通过设置 datacontext 来绑定 然而 我真的很好奇什么时候能够使用绑定元素名 什么时候不能使用
  • __cxa_pure_virtual 的目的是什么?

    在使用 avr gcc 编译时 我遇到了如下链接器错误 undefined reference to cxa pure virtual 我发现了其中指出 The cxa pure virtualfunction 是一个错误处理程序 在调用纯
  • 搜索所有网络上的设备

    我想实现一个代码 通过它我可以列出网络上连接的 upnp 兼容媒体渲染器设备 我用谷歌搜索了这个并找到了以下代码扭曲的网站 https twistedmatrix com documents current core howto udp h
  • 使用 Java 将数据写入 Google Sheets

    我需要将收到的所有反馈放入 Google 表格中 我正在关注这个article https www baeldung com google sheets java client这样做 但问题是 如果我按照这篇文章进行操作 每次需要将某些内容
  • SharedPreferences.edit() 没有相应的 commit() 或 apply() 调用

    我正在将 SharedPreferences 用于我的应用程序的介绍滑块 但是 我在这一行收到错误 class PrefManager private SharedPreferences pref private SharedPrefere
  • Jquery fadeIn 导致滚动顶部,我该如何解决?

    我对 jQuery fadeIn 或 fadeOut 方法有疑问 我建立了一个文章旋转器 一切正常 但是当页面滚动到底部并且文章旋转时出现问题 fadeIn 或fadeOut 方法导致滚动到文章位置 我认为这些方法改变了body的css t
  • 如何在后台线程中创建和使用WebBrowser?

    如何在后台 STA 线程中创建 System Windows Forms WebBrowser 我尝试使用这样的代码 var tr new Thread wbThread tr SetApartmentState ApartmentStat
  • 在控制台上用Java打印金字塔

    我怎样才能像这样在Java中打印金字塔 1 23 456 78910 我当前的代码如下所示 public class T public static void main String args int i j num 1 int n Int
  • 使用spring构建Web项目时如何修复MojoFailureException

    最近我使用spring STS和roo 1 2 0 M1来构建一个web项目 我设置了 jpa 并创建了一个具有某些字段的实体 并为该实体创建了一个存储库和一个服务层 然后当我执行测试时 它给出了以下错误 roo gt perform te