Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.4.1
-
Fix Version/s: 1.4.3
-
Labels:None
-
Environment:Cruisecontrol 2.2, Maven 1.0.2, JXR 1.4.2, 1.4.1_01, Windows 2000 Server.
-
Number of attachments :
Description
When running my maven script (multiproject:site) from Cruisecontrol 2.2, the jxr plugin causes random build failures, even though my code is OK. I can not recreate this problem running outside Cruisecontrol. The build fails with this message:
maven-jxr-plugin:report
[echo]
Scanning D:\builds\checkout****\java
BUILD FAILED
File...... C:\Documents and Settings\edialog\.maven\cache\maven-multiproject-plugin-1.3.1\plugin.jelly
Element... maven:reactor
Line...... 103
Column.... 9
Unable to obtain goal [site] – C:\Documents and Settings\edialog\.maven\cache\maven-jxr-plugin-1.4.2\plugin.jelly:105:31: <jxr:jxr> D:\builds\checkout***\target\docs\xref\index.html (The process cannot access the file because it is being used by another process)
Total time: 6 minutes 41 seconds
Finished at: Fri Dec 03 10:54:48 CET 2004
I've created a workaround for this:
In CodeTransform.java, I've added a catch statement before the finally block in the transform method:
catch (FileNotFoundException e)
{ System.out.println("IGNORING: FileNotFoundException - file is probably in use by another process! Unable to process " + sourcefile + " => " + destfile); }catch (RuntimeException e)
{ System.out.println("Unable to process " + sourcefile + " => " + destfile); throw e; }Also, I've added some cleanup code in the doJellyFile method in the DirectoryIndexer.java:
private void doJellyFile(String templateName, String outDir, JellyContext context)
throws Exception
{
String outFile = outDir + "/" + templateName + ".html";
OutputStream out = null;
try
{
// Throws FileNotFoundException
out = new FileOutputStream(outFile);
String templateFileName = getTemplateDir() + "/" + templateName + ".jelly";
File templateFile = new File(templateFileName);
File theFile = new File(outFile);
File dir = theFile.getParentFile();
if (dir != null)
// Throws UnsupportedEncodingException
XMLOutput xmlOutput = XMLOutput.createXMLOutput(out, false);
// Throws JellyException
context.runScript(templateFile, xmlOutput);
// Throws IOException
xmlOutput.flush();
}
catch (Throwable e)
finally
{
try
{
if( out != null )
}
catch (IOException e)
}
}
This seems to do the trick for now, but I guess the xref docs could be in a state of limbo sometimes.
The CodeTransform class with a little bit more catching and "logging"