[英]How do I use TestNG with Apache Ivy?
I tried to use TestNG with Apache Ivy , but was unsuccessful. 我尝试将TestNG与Apache Ivy一起使用,但未成功。 Here is my
ivy.xml
: 这是我的
ivy.xml
:
<ivy-module version="2.0">
<info organisation="me" module="myproject"/>
<dependencies>
<dependency org="org.testng" name="testng" rev="5.8" />
</dependencies>
</ivy-module>
This fails to actually download a TestNG jarfile. 这无法实际下载TestNG jar文件。 It seems to be because TestNG has a jarfile for jdk14 and jdk15.
这似乎是因为TestNG有一个jdk14和jdk15的jar文件。 Here's the output from
ivy:retrieve
: 这是
ivy:retrieve
的输出ivy:retrieve
:
[ivy:retrieve] :: resolving dependencies :: me#myproject;working@jared-mbp17
[ivy:retrieve] confs: [default]
[ivy:retrieve] found org.testng#testng;5.8 in public
[ivy:retrieve] :: resolution report :: resolve 1139ms :: artifacts dl 11ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 1 | 1 | 0 || 1 | 0 |
---------------------------------------------------------------------
[ivy:retrieve]
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] [FAILED ] org.testng#testng;5.8!testng.jar: (0ms)
[ivy:retrieve] ==== shared: tried
[ivy:retrieve] /Users/jared/.ivy2/shared/org.testng/testng/5.8/jars/testng.jar
[ivy:retrieve] ==== public: tried
[ivy:retrieve] http://repo1.maven.org/maven2/org/testng/testng/5.8/testng-5.8.jar
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: FAILED DOWNLOADS ::
[ivy:retrieve] :: ^ see resolution messages for details ^ ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: org.testng#testng;5.8!testng.jar
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
In the repository you can see two different jarfiles: http://repo1.maven.org/maven2/org/testng/testng/5.8/testng-5.8-jdk14.jar http://repo1.maven.org/maven2/org/testng/testng/5.8/testng-5.8-jdk15.jar 在存储库中,您可以看到两个不同的jar文件: http : //repo1.maven.org/maven2/org/testng/testng/5.8/testng-5.8-jdk14.jar http://repo1.maven.org/maven2/org /testng/testng/5.8/testng-5.8-jdk15.jar
How do I specify either jdk14
or jdk15
? 如何指定
jdk14
或jdk15
?
You need to specify the classifier of the artifact you want. 您需要指定所需工件的分类器。
There is a related fix as of 2.1.0-RC1 . 从2.1.0-RC1开始有一个相关的修复 。 You can use the element
artifact
within the dependency
element to specify the classifier
you want. 您可以使用
dependency
元素中的元素artifact
来指定所需的classifier
。 In this case, the classifier should be jdk14
or jdk15
. 在这种情况下,分类器应为
jdk14
或jdk15
。 If you want jdk15
your ivy.xml
would then be: 如果你想要
jdk15
你的ivy.xml
那么:
<ivy-module version="2.0"
xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="me" module="myproject"/>
<dependencies>
<dependency org="org.testng" name="testng" rev="5.8"
transitive="false">
<artifact name="testng" type="jar" ext="jar" e:classifier="jdk15" />
</dependency>
</dependencies>
</ivy-module>
Note the specification of the XML namespace "http://ant.apache.org/ivy/extra"
as an attribute of the ivy-module
element. 请注意XML命名空间
"http://ant.apache.org/ivy/extra"
的规范作为ivy-module
元素的属性。 Without that the e:classifier
won't work. 没有它,
e:classifier
将无法工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.