maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bert Van der Heyden (JIRA)" <j...@codehaus.org>
Subject [jira] Issue Comment Edited: (MJAVADOC-136) UmlGraph 4.8 - could not find map file
Date Sat, 08 Dec 2007 21:10:57 GMT

    [ http://jira.codehaus.org/browse/MJAVADOC-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_116261
] 

heydenb edited comment on MJAVADOC-136 at 12/8/07 3:10 PM:
-----------------------------------------------------------------------

I had exactly the same problem and it has indeed nothing to do with UmlGraphDoc which is a
wonderful tool I must admit.
I assume this is a Windows XP issue which has to do with the fact that Runtime.getRuntime().exec("some
command") always fails.
Anyway, I have found a cure: By building a bat file in the temp directory containing the correct
command and using the ProcessBuilder class afterwards to run that bat file, it works like
a charm. It took me a while to find that out, but it was worth every second. Those generated
UML diagrams are just very cool.

And here is the code for in UmlGraphDoc
{code:title=Bar.java|borderStyle=solid}
// Some comments here
private static void runGraphviz(String outputFolder, String packageName,
		String name, RootDoc root) {
	
	File dotFile = new File(outputFolder, (new StringBuilder()).append(
			packageName.replace(".", "/")).append("/").append(name).append(
			".dot").toString());
	File pngFile = new File(outputFolder, (new StringBuilder()).append(
			packageName.replace(".", "/")).append("/").append(name).append(
			".png").toString());
	File mapFile = new File(outputFolder, (new StringBuilder()).append(
			packageName.replace(".", "/")).append("/").append(name).append(
			".map").toString());
	try {
		String[] dotCmdArray=new String[] { "dot", "-Tcmapx", "-o",
				"\"" + mapFile.getAbsolutePath() + "\"", "-Tpng", "-o",
				"\"" + pngFile.getAbsolutePath() + "\"",
				"\"" + dotFile.getAbsolutePath() + "\""};
		StringBuffer dotCmd=new StringBuffer();
		for (int i=0;i<dotCmdArray.length;i++){
			dotCmd.append(dotCmdArray[i]);
			dotCmd.append(" ");
		}
		
		String cmd=dotCmd.toString();
		String tmpBatFile=System.getenv("temp") + "/rundot.bat";
		try{
			BufferedWriter out=new BufferedWriter(new FileWriter(tmpBatFile));
			out.write("echo off\n");
			out.write(cmd);
			out.close();
		}catch(IOException e){}
		
		List<String> command = new ArrayList<String>();
		command.add(tmpBatFile);
	    command.add("/A");

	    ProcessBuilder builder = new ProcessBuilder(command);
	    Map<String, String> environ = builder.environment();
	    builder.directory(new File(System.getenv("temp")));

	    final Process process = builder.start();
	    InputStream is = process.getInputStream();
	    InputStreamReader isr = new InputStreamReader(is);
	    BufferedReader br = new BufferedReader(isr);
	    String line;
	    while ((line = br.readLine()) != null) {
	      //System.out.println(line);
	    }
	    //System.out.println("Program terminated!");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
{code} 



      was (Author: heydenb):
    I had exactly the same problem and it has indeed nothing to do with UmlGraphDoc which
is a wonderful tool I must admit.
I assume this is a Windows XP issue which has to do with the fact that Runtime.getRuntime().exec("some
command") always fails.
Anyway, I have found a cure: By building a bat file in the temp directory containing the correct
command and using the ProcessBuilder class afterwards to run that bat file, it works like
a charm. It took me a while to find that out, but it was worth every second. Those generated
UML diagrams are just very cool.

And here is the code for in UmlGraphDoc
{{
private static void runGraphviz(String outputFolder, String packageName,
		String name, RootDoc root) {
	
	File dotFile = new File(outputFolder, (new StringBuilder()).append(
			packageName.replace(".", "/")).append("/").append(name).append(
			".dot").toString());
	File pngFile = new File(outputFolder, (new StringBuilder()).append(
			packageName.replace(".", "/")).append("/").append(name).append(
			".png").toString());
	File mapFile = new File(outputFolder, (new StringBuilder()).append(
			packageName.replace(".", "/")).append("/").append(name).append(
			".map").toString());
	try {
		String[] dotCmdArray=new String[] { "dot", "-Tcmapx", "-o",
				"\"" + mapFile.getAbsolutePath() + "\"", "-Tpng", "-o",
				"\"" + pngFile.getAbsolutePath() + "\"",
				"\"" + dotFile.getAbsolutePath() + "\""};
		StringBuffer dotCmd=new StringBuffer();
		for (int i=0;i<dotCmdArray.length;i++){
			dotCmd.append(dotCmdArray[i]);
			dotCmd.append(" ");
		}
		
		String cmd=dotCmd.toString();
		String tmpBatFile=System.getenv("temp") + "/rundot.bat";
		try{
			BufferedWriter out=new BufferedWriter(new FileWriter(tmpBatFile));
			out.write("echo off\n");
			out.write(cmd);
			out.close();
		}catch(IOException e){}
		
		List<String> command = new ArrayList<String>();
		command.add(tmpBatFile);
	    command.add("/A");

	    ProcessBuilder builder = new ProcessBuilder(command);
	    Map<String, String> environ = builder.environment();
	    builder.directory(new File(System.getenv("temp")));

	    final Process process = builder.start();
	    InputStream is = process.getInputStream();
	    InputStreamReader isr = new InputStreamReader(is);
	    BufferedReader br = new BufferedReader(isr);
	    String line;
	    while ((line = br.readLine()) != null) {
	      //System.out.println(line);
	    }
	    //System.out.println("Program terminated!");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
}}

  
> UmlGraph 4.8 - could not find map file
> --------------------------------------
>
>                 Key: MJAVADOC-136
>                 URL: http://jira.codehaus.org/browse/MJAVADOC-136
>             Project: Maven 2.x Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Windows XP
>            Reporter: gvsg
>            Assignee: Vincent Siveton
>            Priority: Blocker
>             Fix For: 2.4
>
>
> I'm using the maven-javadoc-plugin with the umlgraph doclet.
> See below my partial pom.xml file.
> 			<plugin>
> 	            <groupId>org.apache.maven.plugins</groupId>
> 	            <artifactId>maven-javadoc-plugin</artifactId>
> 				<configuration>
> 					<aggregate>true</aggregate>
> 					<doclet>gr.spinellis.umlgraph.doclet.UmlGraphDoc</doclet>
> 					<docletArtifact>
> 					  <groupId>gr.spinellis</groupId>
> 					  <artifactId>UmlGraph</artifactId>
> 					  <version>4.8</version>
> 					</docletArtifact>
> 					<additionalparam>
> 					   -inferrel -inferdep -quiet -hide java.*
> 					   -collpackages java.util.* -qualify
> 					   -postfixpackage -nodefontsize 9
> 					   -nodefontpackagesize 7
> 					</additionalparam> 
> 				</configuration>	
> 			</plugin>
> When executing the javadoc plugin I receive the following error:
> [WARNING] javadoc: warning - Could not find map file .\com\vangenechten\system\order\service\ConfirmationSloganManagementBean.map
> [WARNING] java.io.IOException: CreateProcess: dot -Tcmapx -o E:\erp\java\systems\order\internals\target\site\apidocs\.\com\vangenechten\system\order\service\CommercialDivisionManagementBean.map
-Tpng -o E:\erp\java\systems\order\internals\target\site\apidocs\.\com\vangenechten\system\order\service\C
> ommercialDivisionManagementBean.png E:\erp\java\systems\order\internals\target\site\apidocs\.\com\vangenechten\system\order\service\CommercialDivisionManagementBean.dot
error=2
> [WARNING] at java.lang.ProcessImpl.create(Native Method)
> [WARNING] at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
> [WARNING] at java.lang.ProcessImpl.start(ProcessImpl.java:30)
> [WARNING] at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
> [WARNING] at java.lang.Runtime.exec(Runtime.java:591)
> [WARNING] at java.lang.Runtime.exec(Runtime.java:464)
> [WARNING] at gr.spinellis.umlgraph.doclet.UmlGraphDoc.runGraphviz(UmlGraphDoc.java:131)
> [WARNING] at gr.spinellis.umlgraph.doclet.UmlGraphDoc.generateContextDiagrams(UmlGraphDoc.java:114)
> [WARNING] at gr.spinellis.umlgraph.doclet.UmlGraphDoc.start(UmlGraphDoc.java:64)
> [WARNING] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [WARNING] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [WARNING] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [WARNING] at java.lang.reflect.Method.invoke(Method.java:585)
> [WARNING] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
> [WARNING] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
> [WARNING] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
> [WARNING] at com.sun.tools.javadoc.Start.begin(Start.java:128)
> [WARNING] at com.sun.tools.javadoc.Main.execute(Main.java:41)
> [WARNING] at com.sun.tools.javadoc.Main.main(Main.java:31)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message