A good open source tool that generated code from UML is AndroMDA. To create UML diagrams visually, I searched for a tool that integrated well with IDEs. Papyrus was my first choice, primarily because it had a eclipse plugin. But I ran in to a number of problems and almost gave up on it.
This blog entry documents some of the problems I faced using AndroMDA with Papyrus and Eclipse IDE and solutions to them.
First, here is my setup.
- Eclipse : Since I will be creating a spring application, I downloaded STS toolset and installed it.
- Papyrus : Used Eclipse install new software option and installed Papyrus MDT SDK from eclipse update site
- AndroMDA : Followed the instructions at AndroMDA's environment setup page to get local maven repository updated.
Note:- I was using a mac and the maven config file in the local ~/.m2/conf/settings.xml did not get picked up. So I made changes to the global conf/settings.xml file for maven.
- Index out of bounds error when opening model in Papyrus editor.
- Open the *.di file in text editor mode and check the xml for tag errors.
- In particular, check the <children> tags inside the <windows> tag towards the end of the file.
Deleting the <sashmodel> node and replacing it with the following helps me reopen my model in eclipse/papyrus.
Warning :- Please make sure you have a backup copy of the uml model and related *.di and *.notation files before applying the change. -
<sashModel currentSelection="//@sashModel/@windows.0/@children.0"> <windows> <children xsi:type="di:TabFolder"/> </windows> </sashModel> - Unable to open UML file in eclipse's papyrus perspective.
- The pathmap variable used by UML mapping code did not pick up the data types defined by AndroMDA in ~/.m2/repository/org/andromda/profiles/emf/uml22/andromda-*/3.4-SNAPSHOT/*.uml
- So made a symbolic link in folder containing UML files.
- ln -s ~/.m2/repository/org/andromda/profiles/emf/uml22/andromda-*/3.4-SNAPSHOT/*.uml .
- Unable to create Payprus model using AndroMDA profile
- Instead of creating a new model directly, right click on the UML file and then say New->Other->Papyrus->New Papyrus model to pick up datatypes defined by the AndroMDA generated UML file.
- Unable to draw model diagrams.
- Open Model Explorer view and then double click on the UML file/Model
- Now right click on the model showing up in the Model Explorer view and choose what diagram you want.
- Unable to add Comments/Description to UML objects.
- Open Documentation View and click on the object for which comments are to be added.
- Add comment in the Documentation window that is now showing for the UML object.
- Unable to add return types to Methods/Operation defined.
Click on the Advanced tab in properties panel, Choose the Type element's value cell, cick on the ...., scroll all the way down until you reach the required return type.
For example, those using the androMDA tutorial, scroll down all the way until you see UserVO[] and then click it.- While adding a new operation, click on + symbol found above the Owned Parameter box in UML tab of Properties window for the operation. Add new parameter with Direction value set to return.
Keep in mind the Service Implementation class is generated only once and never modified by build process to reflect changes to return type of methods. Be careful as to not lose any code changes made manually to the service implementation class if you force the build process to regenerate Service Implementation class.
In case of a Collection<class> return value, set Multiplicity property accordingly. - For example, to set a return value Collection<UserVO>, set Multiplicity value to 0...*
- NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider
- lowering version of hibernate-commons-annotations to 3.2.0-Final from 3.3.0.ga helps
- Setting andromda_persistence_table value to override generated table name
- Add stereotype Persistance Class and then expand it.
- .... more ....