Author: xavier
Date: Wed Nov 28 05:22:28 2007
New Revision: 598989
URL: http://svn.apache.org/viewvc?rev=598989&view=rev
Log:
improve feedback on how latest compatible conflict manager handles problem, and
improve some error reporting details (IVY-648)
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ivy-report.xsl
incubator/ivy/core/trunk/src/java/org/apache/ivy/util/MessageLoggerHelper.java
Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Wed
Nov 28 05:22:28 2007
@@ -27,6 +27,7 @@
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.resolve.ResolveProcessException;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.filter.FilterHelper;
@@ -291,8 +292,10 @@
} catch (ParseException e) {
log(e.getMessage(), Project.MSG_ERR);
throw new BuildException("syntax errors in ivy file: " + e, e);
+ } catch (ResolveProcessException e) {
+ throw new BuildException("impossible to resolve dependencies:\n\t"
+ e.getMessage(), e);
} catch (Exception e) {
- throw new BuildException("impossible to resolve dependencies: " +
e, e);
+ throw new BuildException("impossible to resolve dependencies:\n\t"
+ e, e);
}
}
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
Wed Nov 28 05:22:28 2007
@@ -1104,6 +1104,10 @@
return eviction.getAllEvictingNodes();
}
+ public Collection/*<String>*/ getAllEvictingNodesDetails() {
+ return eviction.getAllEvictingNodesDetails();
+ }
+
public String[] getEvictedConfs() {
return eviction.getEvictedConfs();
}
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
Wed Nov 28 05:22:28 2007
@@ -49,28 +49,57 @@
private String rootModuleConf;
+ private String detail;
+
/**
* Creates a new object containing the eviction data of an [EMAIL
PROTECTED] IvyNode}.
*
- * @param rootModuleConf the rootmodule configuration
- * @param parent the parent node (or <tt>null</tt> in case of
transitive eviction)
- * @param conflictManager the conflictmanager which evicted the node
(or <tt>null</tt> in
- * case of transitive eviction)
- * @param selected a collection of [EMAIL PROTECTED] IvyNode}s which
evict the evicted node (or
- * <tt>null</tt> in case of transitive eviction)
+ * @param rootModuleConf
+ * the root module configuration
+ * @param parent
+ * the parent node (or <tt>null</tt> in case of transitive
eviction)
+ * @param conflictManager
+ * the conflict manager which evicted the node (or
<tt>null</tt> in case of
+ * transitive eviction)
+ * @param selected
+ * a collection of [EMAIL PROTECTED] IvyNode}s which evict
the evicted node (or
+ * <tt>null</tt> in case of transitive eviction)
*/
public EvictionData(String rootModuleConf, IvyNode parent,
ConflictManager conflictManager,
Collection selected) {
+ this(rootModuleConf, parent, conflictManager, selected, null);
+ }
+
+ /**
+ * Creates a new object containing the eviction data of an [EMAIL
PROTECTED] IvyNode}.
+ *
+ * @param rootModuleConf
+ * the root module configuration
+ * @param parent
+ * the parent node (or <tt>null</tt> in case of transitive
eviction)
+ * @param conflictManager
+ * the conflict manager which evicted the node (or
<tt>null</tt> in case of
+ * transitive eviction)
+ * @param selected
+ * a collection of [EMAIL PROTECTED] IvyNode}s which evict
the evicted node (or
+ * <tt>null</tt> in case of transitive eviction)
+ * @param detail
+ * a String detailing the reason why the node was evicted
+ */
+ public EvictionData(String rootModuleConf, IvyNode parent,
ConflictManager conflictManager,
+ Collection selected, String detail) {
this.rootModuleConf = rootModuleConf;
this.parent = parent;
this.conflictManager = conflictManager;
this.selected = selected;
+ this.detail = detail;
}
public String toString() {
if (selected != null) {
- return selected + " in " + parent + " (" + conflictManager +
") [" + rootModuleConf
- + "]";
+ return selected + " in " + parent
+ + (detail == null ? "" : " " + detail)
+ + " (" + conflictManager + ") [" + rootModuleConf + "]";
} else {
return "transitively [" + rootModuleConf + "]";
}
@@ -95,6 +124,10 @@
public boolean isTransitivelyEvicted() {
return parent == null;
}
+
+ public String getDetail() {
+ return detail;
+ }
}
private static final class ModuleIdConf {
@@ -296,7 +329,7 @@
}
/**
- * Returns null if this node has only be evicted transitively, or the the
colletion of selected
+ * Returns null if this node has only be evicted transitively, or the the
collection of selected
* nodes if it has been evicted by other selected nodes
*
* @return
@@ -314,6 +347,27 @@
}
}
return allEvictingNodes;
+ }
+
+ public Collection/*<String>*/ getAllEvictingNodesDetails() {
+ Collection ret = null;
+ for (Iterator iter = evicted.values().iterator(); iter.hasNext();) {
+ EvictionData ed = (EvictionData) iter.next();
+ Collection selected = ed.getSelected();
+ if (selected != null) {
+ if (ret == null) {
+ ret = new HashSet();
+ }
+ if (selected.size() == 1) {
+ ret.add(selected.iterator().next()
+ + (ed.getDetail() == null ? "" : " " +
ed.getDetail()));
+ } else if (selected.size() > 1) {
+ ret.add(selected
+ + (ed.getDetail() == null ? "" : " " +
ed.getDetail()));
+ }
+ }
+ }
+ return ret;
}
public Collection getAllEvictingConflictManagers() {
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
Wed Nov 28 05:22:28 2007
@@ -33,6 +33,7 @@
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.RestartResolveProcess;
import org.apache.ivy.core.resolve.IvyNodeCallers.Caller;
+import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.latest.LatestStrategy;
import org.apache.ivy.plugins.version.VersionMatcher;
@@ -182,17 +183,24 @@
private void
blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
IvyNode parent, IvyNode selected, IvyNode evicted) {
- Collection toBlacklist = blackListIncompatibleCaller(
+ final Collection toBlacklist = blackListIncompatibleCaller(
settings.getVersionMatcher(), parent, selected, evicted, evicted);
if (toBlacklist != null) {
+ final StringBuffer blacklisted = new StringBuffer();
for (Iterator iterator = toBlacklist.iterator();
iterator.hasNext();) {
IvyNodeBlacklist blacklist = (IvyNodeBlacklist)
iterator.next();
blacklist.getBlacklistedNode().blacklist(blacklist);
+ blacklisted.append(blacklist.getBlacklistedNode());
+ if (iterator.hasNext()) {
+ blacklisted.append(" ");
+ }
}
String rootModuleConf =
IvyContext.getContext().getResolveData().getReport().getConfiguration();
- evicted.markEvicted(rootModuleConf, parent, this,
Collections.singleton(selected));
+ evicted.markEvicted(
+ new EvictionData(rootModuleConf, parent, this,
Collections.singleton(selected),
+ "with blacklisting of " + blacklisted));
if (settings.debugConflictResolution()) {
Message.debug("evicting " + evicted + " by "
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/LogReportOutputter.java
Wed Nov 28 05:22:28 2007
@@ -76,7 +76,7 @@
if (evicted.length > 0) {
Message.info("\t:: evicted modules:");
for (int i = 0; i < evicted.length; i++) {
- Collection allEvictingNodes = evicted[i].getAllEvictingNodes();
+ Collection allEvictingNodes =
evicted[i].getAllEvictingNodesDetails();
if (allEvictingNodes == null) {
Message.info("\t" + evicted[i] + " transitively in "
+ Arrays.asList(evicted[i].getEvictedConfs()));
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportOutputter.java
Wed Nov 28 05:22:28 2007
@@ -174,6 +174,9 @@
} else {
details.append(" evicted=\"transitive\"");
}
+ details.append(" evicted-reason=\"")
+ .append(XMLHelper.escape(ed.getDetail() == null ? "" :
ed.getDetail()))
+ .append("\"");
}
if (dep.hasProblem()) {
details.append(" error=\"").append(
@@ -253,6 +256,9 @@
+ " rev=\""
+ XMLHelper.escape(
callers[i].getAskedDependencyId().getRevision()) + "\""
+ + " callerrev=\""
+ + XMLHelper.escape(
+ callers[i].getModuleRevisionId().getRevision()) + "\""
+ callerDetails + "/>");
}
ArtifactDownloadReport[] adr =
report.getDownloadReports(dep.getResolvedId());
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ivy-report.xsl
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ivy-report.xsl?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ivy-report.xsl
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/ivy-report.xsl
Wed Nov 28 05:22:28 2007
@@ -45,12 +45,13 @@
<xsl:template name="calling">
<xsl:param name="org" />
<xsl:param name="mod" />
- <xsl:if test="count($modules/revision/[EMAIL PROTECTED] and @name=$mod]) =
0">
+ <xsl:param name="rev" />
+ <xsl:if test="count($modules/revision/[EMAIL PROTECTED] and @name=$mod and
@callerrev=$rev]) = 0">
<table><tr><td>
No dependency
</td></tr></table>
</xsl:if>
- <xsl:if test="count($modules/revision/[EMAIL PROTECTED] and @name=$mod]) >
0">
+ <xsl:if test="count($modules/revision/[EMAIL PROTECTED] and @name=$mod and
@callerrev=$rev]) > 0">
<table class="deps">
<thead>
<tr>
@@ -65,7 +66,7 @@
</tr>
</thead>
<tbody>
- <xsl:for-each select="$modules/revision/[EMAIL PROTECTED] and
@name=$mod]">
+ <xsl:for-each select="$modules/revision/[EMAIL PROTECTED] and
@name=$mod and @callerrev=$rev]">
<xsl:call-template name="called">
<xsl:with-param name="callstack" select="concat($org,
string('/'), $mod)"/>
<xsl:with-param name="indent" select="string('')"/>
@@ -129,7 +130,7 @@
</tr>
<xsl:if test="not($revision/@evicted)">
<xsl:if test="not(contains($callstack, concat($organisation, string('/'),
$module)))">
- <xsl:for-each select="$modules/revision/[EMAIL PROTECTED] and
@name=$module]">
+ <xsl:for-each select="$modules/revision/[EMAIL PROTECTED] and
@name=$module and @callerrev=$rev]">
<xsl:call-template name="called">
<xsl:with-param name="callstack" select="concat($callstack,
string('#'), $organisation, string('/'), $module)"/>
<xsl:with-param name="indent" select="concat($indent,
string('---'))"/>
@@ -160,21 +161,21 @@
<xsl:template name="icons">
<xsl:param name="revision"/>
<xsl:if test="$revision/@searched = 'true'">
- <img src="http://ant.apache.org/ivy/images/searched.gif"
alt="searched" title="required a search in repository"/>
+ <img src="http://ivy.jayasoft.org/images/searched.gif" alt="searched"
title="required a search in repository"/>
</xsl:if>
<xsl:if test="$revision/@downloaded = 'true'">
- <img src="http://ant.apache.org/ivy/images/downloaded.gif"
alt="downloaded" title="downloaded from repository"/>
+ <img src="http://ivy.jayasoft.org/images/downloaded.gif"
alt="downloaded" title="downloaded from repository"/>
</xsl:if>
<xsl:if test="$revision/@evicted">
<xsl:element name="img">
- <xsl:attribute
name="src">http://ant.apache.org/ivy/images/evicted.gif</xsl:attribute>
+ <xsl:attribute
name="src">http://ivy.jayasoft.org/images/evicted.gif</xsl:attribute>
<xsl:attribute name="alt">evicted</xsl:attribute>
<xsl:attribute name="title">evicted by <xsl:for-each
select="$revision/evicted-by"><xsl:value-of select="@rev"/>
</xsl:for-each></xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:if test="$revision/@error">
<xsl:element name="img">
- <xsl:attribute
name="src">http://ant.apache.org/ivy/images/error.gif</xsl:attribute>
+ <xsl:attribute
name="src">http://ivy.jayasoft.org/images/error.gif</xsl:attribute>
<xsl:attribute name="alt">error</xsl:attribute>
<xsl:attribute name="title">error: <xsl:value-of
select="$revision/@error"/></xsl:attribute>
</xsl:element>
@@ -259,7 +260,7 @@
<link rel="stylesheet" type="text/css" href="ivy-report.css" />
</head>
<body>
- <div id="logo"><a href="http://ant.apache.org/ivy/"><img
src="http://ant.apache.org/ivy/images/logo.png"/></a></div>
+ <div id="logo"><a href="http://ivy.jayasoft.org/"><img
src="http://ivy.jayasoft.org/logo.png"/></a></div>
<h1>
<xsl:element name="a">
<xsl:attribute name="name"><xsl:value-of
select="info/@organisation"/>-<xsl:value-of
select="info/@module"/></xsl:attribute>
@@ -289,10 +290,10 @@
<table class="header">
<tr><td class="title">Modules</td><td class="value"><xsl:value-of
select="count($modules)"/></td></tr>
<tr><td class="title">Revisions</td><td class="value"><xsl:value-of
select="count($revisions)"/>
- (<xsl:value-of select="count($searcheds)"/> searched <img
src="http://ant.apache.org/ivy/images/searched.gif" alt="searched"
title="module revisions which required a search with a dependency resolver to
be resolved"/>,
- <xsl:value-of select="count($downloadeds)"/> downloaded <img
src="http://ant.apache.org/ivy/images/downloaded.gif" alt="downloaded"
title="module revisions for which ivy file was downloaded by dependency
resolver"/>,
- <xsl:value-of select="count($evicteds)"/> evicted <img
src="http://ant.apache.org/ivy/images/evicted.gif" alt="evicted" title="module
revisions which were evicted by others"/>,
- <xsl:value-of select="count($errors)"/> errors <img
src="http://ant.apache.org/ivy/images/error.gif" alt="error" title="module
revisions on which error occured"/>)</td></tr>
+ (<xsl:value-of select="count($searcheds)"/> searched <img
src="http://ivy.jayasoft.org/images/searched.gif" alt="searched" title="module
revisions which required a search with a dependency resolver to be resolved"/>,
+ <xsl:value-of select="count($downloadeds)"/> downloaded <img
src="http://ivy.jayasoft.org/images/downloaded.gif" alt="downloaded"
title="module revisions for which ivy file was downloaded by dependency
resolver"/>,
+ <xsl:value-of select="count($evicteds)"/> evicted <img
src="http://ivy.jayasoft.org/images/evicted.gif" alt="evicted" title="module
revisions which were evicted by others"/>,
+ <xsl:value-of select="count($errors)"/> errors <img
src="http://ivy.jayasoft.org/images/error.gif" alt="error" title="module
revisions on which error occured"/>)</td></tr>
<tr><td class="title">Artifacts</td><td class="value"><xsl:value-of
select="count($artifacts)"/>
(<xsl:value-of select="count($dlartifacts)"/> downloaded,
<xsl:value-of select="count($faileds)"/> failed)</td></tr>
@@ -359,6 +360,8 @@
<xsl:element name="a">
<xsl:attribute name="href">#<xsl:value-of
select="../@organisation"/>-<xsl:value-of select="../@name"/>-<xsl:value-of
select="@name"/></xsl:attribute>
<xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@evicted-reason"/>
</xsl:element>
<xsl:text> </xsl:text>
</xsl:for-each>
@@ -373,6 +376,7 @@
<xsl:call-template name="calling">
<xsl:with-param name="org" select="info/@organisation"/>
<xsl:with-param name="mod" select="info/@module"/>
+ <xsl:with-param name="rev" select="info/@revision"/>
</xsl:call-template>
<h2>Details</h2>
@@ -421,10 +425,15 @@
</xsl:if>
<xsl:if test="@evicted">
<tr><td class="title">Evicted by</td><td class="value">
- <xsl:for-each select="evicted-by">
+ <b>
+ <xsl:for-each select="evicted-by">
<xsl:value-of select="@rev"/>
- </xsl:for-each>
- in <b><xsl:value-of select="@evicted"/></b> conflict manager
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </b>
+ <xsl:text> </xsl:text>
+ <b><xsl:value-of select="@evicted-reason"/></b>
+ in <b><xsl:value-of select="@evicted"/></b> conflict
manager
</td></tr>
</xsl:if>
</table>
@@ -434,6 +443,7 @@
<tr>
<th>Organisation</th>
<th>Name</th>
+ <th>Revision</th>
<th>In Configurations</th>
<th>Asked Revision</th>
</tr>
@@ -448,6 +458,7 @@
<xsl:value-of select="@name"/>
</xsl:element>
</td>
+ <td><xsl:value-of select="@callerrev"/></td>
<td><xsl:value-of select="@conf"/></td>
<td><xsl:value-of select="@rev"/></td>
</tr>
@@ -460,6 +471,7 @@
<xsl:call-template name="calling">
<xsl:with-param name="org" select="../@organisation"/>
<xsl:with-param name="mod" select="../@name"/>
+ <xsl:with-param name="rev" select="@name"/>
</xsl:call-template>
<h5>Artifacts</h5>
<xsl:if test="count(artifacts/artifact) = 0">
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/util/MessageLoggerHelper.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/util/MessageLoggerHelper.java?rev=598989&r1=598988&r2=598989&view=diff
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/util/MessageLoggerHelper.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/util/MessageLoggerHelper.java
Wed Nov 28 05:22:28 2007
@@ -24,18 +24,23 @@
public static void sumupProblems(MessageLogger logger) {
List myProblems = logger.getProblems();
if (myProblems.size() > 0) {
- logger.info("\n:: problems summary ::");
List myWarns = logger.getWarns();
+ List myErrors = logger.getErrors();
+ logger.info(""); // new line on info to isolate error summary
+ if (!myErrors.isEmpty()) {
+ logger.log(":: problems summary ::", Message.MSG_ERR);
+ } else {
+ logger.log(":: problems summary ::", Message.MSG_WARN);
+ }
if (myWarns.size() > 0) {
- logger.info(":::: WARNINGS");
+ logger.log(":::: WARNINGS", Message.MSG_WARN);
for (Iterator iter = myWarns.iterator(); iter.hasNext();) {
String msg = (String) iter.next();
logger.log("\t" + msg + "\n", Message.MSG_WARN);
}
}
- List myErrors = logger.getErrors();
if (myErrors.size() > 0) {
- logger.info(":::: ERRORS");
+ logger.log(":::: ERRORS", Message.MSG_ERR);
for (Iterator iter = myErrors.iterator(); iter.hasNext();) {
String msg = (String) iter.next();
logger.log("\t" + msg + "\n", Message.MSG_ERR);