提交 e11c01cd 编写于 作者: J Jesse Glick

36236295 regressed handling of optional dependencies.

上级 8035cda4
......@@ -1467,10 +1467,22 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if(dependencies!=null) {
MavenEmbedder embedder = MavenUtil.createEmbedder(new StreamTaskListener(System.out,Charset.defaultCharset()),(File)null,null);
for( String dep : dependencies.split(",")) {
String suffix = ";resolution:=optional";
boolean optional = dep.endsWith(suffix);
if (optional) {
dep = dep.substring(0, dep.length() - suffix.length());
}
String[] tokens = dep.split(":");
String artifactId = tokens[0];
String version = tokens[1];
File dependencyJar=resolveDependencyJar(embedder,artifactId,version);
if (dependencyJar == null) {
if (optional) {
System.err.println("cannot resolve optional dependency " + dep + " of " + shortName + "; skipping");
continue;
}
throw new IOException("Could not resolve " + dep);
}
File dst = new File(home, "plugins/" + artifactId + ".jpi");
if(!dst.exists() || dst.lastModified()!=dependencyJar.lastModified()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册