在尝试在Netbeans中构建Java EE(Maven)项目时,我得到了这些错误(也从cmd与mvn clean install -U
获得了相同的错误构建)
[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.
我不知道该怎么办?
您有测试失败。这意味着代码被明确地设计为测试是否工作,现在说它不工作。
检查测试报告,找出故障是什么—这可能是Netbeans内部最简单的方法(告诉它运行测试)。这可能是任何事情。我的猜测是测试试图与学校网络上的服务器对话,你不能从家里到达,但你需要调查以确定。
编辑:在评论中发布的错误消息说代码期望数据库服务器运行在端口1527上,但没有。
显然,这是Derby数据库(在JDK中以精简版本提供),您需要手动调用服务器。你可能已经从你的老师那里得到了关于如何正确设置的信息。
这个youtube视频声称说"如何修复netbeans数据库端口1527错误"。https://www.youtube.com/watch?v=DM7g0hm_s4w