【发布时间】:2015-09-12 15:08:31
【问题描述】:
我在尝试在 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.
我不知道该怎么办?
【问题讨论】:
-
测试在某些平台上可能会因多种原因而在其他平台上失败。我建议您将问题简化为一个失败的测试并在此处发布。
-
@Tunaki 这是第一行错误:
Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. -
添加-X选项,仔细查看输出控制台。
-
@lametaweb 会试试看的!
-
“在端口 1527 上连接到服务器 localhost 时出错”不言自明。您有一个尝试连接到 localhost 服务器的测试,但它失败了。该服务器是否正确启动并运行?它是否正确接受来自端口 1527 的输入?这个端口开放了吗?
标签: java apache maven jakarta-ee netbeans