Generating XMI from ANT or MAVEN

Is there any ant or maven plugin for generating the XMI model from a VP diagram ?

This would be very usefull to us as we are using MDA to generate code and the MDA engine is fed with XMI from VP. This way we could automate the whole generation process.

Thanks

Hello HugoPalma,

We will support command line operation in 3.1. At that time you will be able to automate the process by executing command to generate XMI. We may also support ant or maven operation at the same time.

Best regards,
Jick

Hello!

In order to keep our project development wiki site automatically up-to-date I am trying to produce images from VP project diagrams with Maven but I have troubles to get it to work. I am using VP Suite 3.4. The Ant script provided with VP is working okay and I have used it as a base for this Maven build.

In pom.xml I have the following:

 
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>process-classes</id>
						<phase>process-classes</phase>
						<configuration>
							<tasks>
								<property name="vpsuiteInstallationPath" value="/path/to/my/VP_Suite3.4" />
								<property name="vpproduct" value="VP-UML" />
								<property name="headless" value="true" />
								<property name="vpworkspace" value="/path/to/my/vpworkspace" />
								<mkdir dir="./target/images" />
								<taskdef resource="com/vp/ant/taskdef.properties" />
								<exportDiagramImage project="${basedir}/project.vpp"
									out="/target/images" type="jpg" workspace="${vpworkspace}"
									product="${vpproduct}" headless="${headless}">
									<diagram name="*" />
								</exportDiagramImage>
							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<!-- Copied VP's ant.jar into own repository -->
						<groupId>com.vp</groupId>
						<artifactId>ant</artifactId>
						<version>3.4</version>
						<type>jar</type>
					</dependency>
				</dependencies>
			</plugin>
 

When I run mvn install I get following error:

 
[exportDiagramImage] /path/to/my/local/m2repo/com/vp/ant/bin is not a valid directory
[exportDiagramImage] 	at org.apache.tools.ant.taskdefs.Java.fork(Java.java:732)
[exportDiagramImage] 	at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:171)
[exportDiagramImage] 	at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
[exportDiagramImage] 	at com.vp.ant.VPUMLCommandLineTask.execute(VPUMLCommandLineTask.java:81)
[exportDiagramImage] 	at com.vp.ant.ExportDiagramImage.execute(ExportDiagramImage.java:45)
[exportDiagramImage] 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[exportDiagramImage] 	at org.apache.tools.ant.Task.perform(Task.java:364)
[exportDiagramImage] 	at org.apache.tools.ant.Target.execute(Target.java:341)
[exportDiagramImage] 	at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:108)
[exportDiagramImage] 	at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:83)
[exportDiagramImage] 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
[exportDiagramImage] 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
[exportDiagramImage] 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
[exportDiagramImage] 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
[exportDiagramImage] 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
[exportDiagramImage] 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
[exportDiagramImage] 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
[exportDiagramImage] 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
[exportDiagramImage] 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
[exportDiagramImage] 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
[exportDiagramImage] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exportDiagramImage] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[exportDiagramImage] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[exportDiagramImage] 	at java.lang.reflect.Method.invoke(Method.java:597)
[exportDiagramImage] 	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[exportDiagramImage] 	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[exportDiagramImage] 	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[exportDiagramImage] 	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
 

Has anyone got VP Maven builds to work? How is it done correctly? It would be really helpful if I got this to work - I’d use a continuous integration service to keep image files used in our wiki up-to-date without manual labour. Of course I could use Ant instead of Maven because that is working but I’d prefer Maven.

Hi Teehilt,

Thanks for your post. Was it you want to use Maven to execute our command line task but failed?

Best regards,
Lilian Wong

Okay, I got it to work with Maven 2 too by using the exactly same syntax as in Ant (with classpath attribute in taskdef):

 
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>process-classes</id>
						<phase>process-classes</phase>
						<configuration>
							<tasks>
...
								<taskdef resource="com/vp/ant/taskdef.properties"
									classpath="${vpsuiteInstallationPath}/lib/ant.jar" />
...
							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
 

And removing the dependency to VP’s ant.jar. Now all I need is a Maven Confluence plugin for adding/updating the created images into wiki… or maybe just a commit with SCM plugin for now because there doesn’t seem to be such a Confluence plugin… :slight_smile:

Hi Teehilt,

Actually you can simply call “ExportDiagramImage.bat” in command line to export your diagrams to images. The ExportDiagramImage.bat is available inside VPSuite/scripts folder.

Best regards,
Lilian Wong

Following the original thought of publishing VP diagrams in (Confluence) wiki site…
Would it be possible to create a VP plugin for that? Reporting to Confluence? That would be the ultimate solution.
Or maybe use the current HTML publishing in VP and convert the HTML to wiki format (with html2wiki Perl script or such) and transfer that into wiki - all this automatically with Maven or Ant. Has anyone else been tackling with this kind of situation - wanting to use wiki as main development resource site and wondering how to put VP diagrams there without too much manual labour…?

Hi Teehilt,

Maybe you can write scripts to call ExportDiagramImage.bat to export diagrams from VP project to an output path, then put the images in the path to wiki site? These can be achieve by batches or ant task, and you can call them in the command line to avoid manual labour.
And using plugin will need to start the application and manual labour to execute, - isn’t it more convenience to use command line instead?

Best regards,
Lilian Wong

[quote=LilianWong]Hi Teehilt,

Maybe you can write scripts to call ExportDiagramImage.bat to export diagrams from VP project to an output path, then put the images in the path to wiki site? These can be achieve by batches or ant task, and you can call them in the command line to avoid manual labour.
And using plugin will need to start the application and manual labour to execute, - isn’t it more convenience to use command line instead?

Best regards,
Lilian Wong[/quote]

Yes, I can do that: use Ant (or Maven or script) to produce image files and copy them into wiki (or some other) web service path structure where they can be referenced from inside the wiki.

But, it would be in my opinion more convienent if there would be an option in Visual Paradigm for publishing into wiki. Something like Tools–>Report–>Generate Wiki report… This option would allow to select (in Confluence wiki) a correct space and parent page and publish the same kind of structure as is in HTML or PDF reports (preferably with options like page-per-diagram or all-in-single-page or such) into wiki. User would have to provide the URL for wiki and username/password of course. This is what I meant by my question whether it would be possible to create a VP plugin for this kind of task. Of course it would be much work and wikis are not all the same with different remote APIs etc.

With this kind of functionality there would be no need for command line - the user could publish his/hers work directly from VP in similar way as with HTML and PDF reporting.

Best regards,
Teemu Hiltunen

Hi Teemu Hiltunen,

Thanks for replying. In next release, we will introduce a new report engine which is more customizable for the report output. With this new feature, I think you can build the report details which are closer to your expectation.
Then you can use Open API to generate what you need to the wiki page, but this requires the application running.

Alternatively, we provide charged customization service, please feel free to send an email to sales-team@visual-paradigm.com if you are interested.

Best regards,
Lilian Wong