尝试在Netbeans中构建Java EE(Maven)项目时出现这些错误(同样的错误是使用mvn clean install -U
从cmd构建的)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project myproject: There are test failures.
奇怪的是,我在尝试使用其他PC时遇到了同样的错误,但是,当我尝试在学校建设时,没有任何错误,并且工作正常。学校没有测试错误。
为什么会这样?有谁有想法吗?
对不起,如果这个问题是"坏" stackoverflow问题,但我无处可去寻求帮助。
编辑:
现在我明白了:
Tests run: 10, Failures: 0, Errors: 0, Skipped: 0
这很好,但我仍然遇到此错误并构建失败:
Failed to execute goal org.apache.maven.plugins:maven-source-plugin:2.4:jar (attach-sources) on project backend: Execution attach-sources of goal org.apache.maven.plugins:maven-source-plugin:2.4:jar failed: Plugin org.apache.maven.plugins:maven-source-plugin:2.4 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-source-plugin:jar:2.4 (): Failed to read artifact descriptor for org.apache.maven:maven-archiver:jar:2.5: Could not transfer artifact org.apache.maven:maven-archiver:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
在构建开始时,我收到了这些警告:
Some problems were encountered while building the effective model for edu.cth.myproject:backend:ejb:1.0-SNAPSHOT
build.plugins.plugin.version for org.apache.maven.plugins:maven-source-plugin is missing.
build.plugins.plugin.version for org.apache.maven.plugins:maven-javadoc-plugin is missing.
build.plugins.plugin.version for org.apache.maven.plugins:maven-deploy-plugin is missing.
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
我不知道该怎么办?
答案 0 :(得分:2)
您有测试失败。这意味着明确设计用于测试事物是否正常的代码,现在说它没有。
调查测试报告以找出失败的原因 - 这可能是Netbeans中最容易的(告诉它运行测试)。这可能是任何事情。我的猜测将是测试试图与您无法从家中联系的学校网络上的服务器进行通信,但您需要进行调查以确定。
编辑:评论中发布的错误消息表示代码期望数据库服务器在端口1527上运行,但没有一个是。
显然这是Derby数据库(在JDK中以精简版本提供),您需要手动调用服务器。您可能已收到老师提供的有关如何正确设置此信息的信息。
此youtube视频声称"如何修复netbeans数据库端口1527错误"。 https://www.youtube.com/watch?v=DM7g0hm_s4w