企业架构师与代码同步
我正在学习EA。我用我的 java 代码做了储备工程并生成了一些类图。然后我更改了代码并复制到EA项目(删除EA使用的原始源代码并将修改后的代码放入)。然后使用代码工程->将包与代码同步以使用修改后的代码更新 EA,添加的新引用显示在其中一个类图中,但在更新的代码中删除的旧引用仍然在其中一个类图中。
而且添加的新文件也没有显示在 EA 项目中。我之前尝试过重新导入源,但当时我的图表丢失了。
我尝试在不同级别(位置)与代码同步,甚至使用查看源代码功能在本地修改代码,但仍然相同。
我需要为此设置任何选项吗?
EA版本是8.0.860。
I am learning EA. I did reserve engineering with my java code and generated some class diagrams. Then I changed my code and copy over to EA project (delete the original source code which EA used and put the modified in). Then use Code Engineering -> Synchroize Package with Code to update EA with the modified code, the new reference added was shown up in one of the class diagrams but the old reference which was removed in the updated code was still in one of the class diagrams.
And also the new files added were not shown up in the EA project. I tried reimport source before but my diagrams were lost then.
I tried Synchronize with Code in different level (places) and even modified code locally with View Source Code feature but still the same.
Is there any options I need to set up for this?
The EA version is 8.0.860.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
相关 EA 选项位于选项对话框(工具 - 选项)中的源代码工程分支下。
在“属性/操作”下,有一个选项“在反向同步时,删除不在代码中的模型关联”,我认为默认情况下该选项是关闭的。打开它应该可以解决悬空关联问题。 (属性和方法也有类似的选项。)
相反,在生成代码时,需要设置选项“在正向同步时,提示删除不在模式中的代码功能(原文如此)”,以便 EA 从代码中删除内容已从模型中删除。
让 EA 为新添加的 Java 类创建 UML 类的正常方法是从顶层重做导入;它们不会在同步包期间被拾取。任何图表都不应该以这种方式丢失,除非您添加了自己的图表,而您不应该在源模型中添加图表。
The relevant EA options are located in the Options dialog (Tools - Options), under the Source Code Engineering branch.
Under Attribute/Operations, there is an option "On reverse synch, delete model associations not in code" which I think is off by default. Switching that on should fix the dangling association problem. (There are similar options for attributes and methods.)
Conversely, when generating code, the option "On forward synch, prompt to delete code features not in mode (sic)" needs to be set in order for EA to remove stuff from the code which has been deleted from the model.
The normal way to get EA to create UML classes for newly added Java classes is to redo the import from the top level; they're not picked up during a Synchronize Package. No diagrams should be lost this way, unless possibly if you've added diagrams of your own which you shouldn't do in a source model.