问题
I've made a model in Enterprise Architect using the 'reverse engineering' tool to import my Java classes into the EA model. Now I intend to keep this model up-to-date with the code as the development goes on.
The thing is: when I try to synchronize the code within the model (source -> model) it only works if the source code is still in the same absolute path it was in the disc when I first imported. But if I change the source code's location on the disc, it duplicates my classes.
That is a huge problem considering that every developer has it's own folder structure. It can get worst when it comes to different operational systems (which is my case).
Example:
Location of the source code when it was imported:
/Volumes/Data/Projects/xxx_project/src/...
Location of the source code when it has to be synchronized by another developer:
C:\projects\xxx_project\src\...
Does anybody know how to use a "relative path" to the source code, or to change the binding of the source code's location on the model?
回答1:
The version I use is 8.0.860
The solution is to use a feature called "Locale Paths" in EA. You find it in the menue item Settings-->Locale Paths... It opens a dialog box that enables you to replace local paths in the model with an ID and vice versa. With this feature it is possible to replace a present path in the model with another one. It also gives you the possibility to use the model on different machines with different local paths.
To find out to which local path a given class in the model was bound I grepped the binary file of the model. Then I replaced the path name with the buttons ApplyPath and ExpandPath. To me it seemed that the changes in the model concerning the path take effect not until closing EA and restarting it again.
After that it was possible to see the source code of a class by right clicking the class and executing "View source code..." at the new location on the disk.
回答2:
I'm using version 9.0
The solution here:
- On the class diagram, choose "Generate code..." (F11)
- Select the new class file location as Path
- Save
And the binding should be fixed.
来源:https://stackoverflow.com/questions/4974836/enterprise-architect-how-to-synchronize-with-source-code-source-model-when