Maven 3.0.3 使用旧的 JUnit 插件,它没有 org.junit.* 包
我正在使用 Hudson 并尝试从 subversion 存储库构建一个 Maven 项目。 问题是,我猜 Maven 下载了旧的 junit 版本,因为我发现了这个:
下载:..repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom 下载:..repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom(998 B,2.0 KB/秒)
后来它抱怨包 org.junit.* 不存在。
当我让 Hudson 构建该项目的本地副本(不是 subversion 管理)时,它会启动 junit 测试:
TESTS
Running JUnitTest ...
我的 pom.xml 看起来像这样:
http://codeviewer.org/view/code:2227< /a>
(我也尝试过 朱尼特 4.8.2 没有方括号,这没有任何帮助。 )
如何运行 JUnit 测试?
I'm using Hudson and trying to build a maven project from subversion repository.
Problem is, that Maven downloads an old junit version, I guess, because I found this:
Downloading: ..repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
Downloaded: ..repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 2.0 KB/sec)
Later it complains that package org.junit.* doesn't exist.
When I instead let Hudson built a local copy of this project (not subversion managed), it starts the junit test:
T E S T S
Running JUnitTest
...
My pom.xml looks like this:
http://codeviewer.org/view/code:2227
(I also tried
junit
4.8.2
without the square brackets, which didn't help anything.
)
How do I get the JUnit Tests to run?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然 pom 中指定了
4.8.2
版本的 junitdependency
,但它位于
标记之间。因此,除非在构建中显式定义依赖项,否则不会使用该版本。您可以通过两种方式解决该问题。
删除外部
标记 - 仅保留内容。除了 pom 文件中
和
标记之间存在的内容之外,还定义以下内容。Pom 参考
Though junit
dependency
with4.8.2
version is specified in the pom, it is between<dependencyManagement>
tag. As such that version will not be used, unless the dependendency is explicitly defined in the build.You could fix the problem in two ways.
Remove the outer
<dependencyManagement>
tag - just retain the contents.Define the following in addition to what is present in the pom file between
<dependencyManagement>
and<build>
tags.Pom reference