在 Eclipse 中处理 Roo 生成的 AspectJ 文件

发布于 2025-01-08 05:54:49 字数 109 浏览 5 评论 0原文

我使用命令提示符生成了一个示例 roo 项目,然后将其导入到 eclipse 中。但是我发现大多数重要文件都是 aj 扩展名。我如何将这些文件更改为 java 文件。我想在 eclipse 中执行此操作。

I have generated a sample roo project using command prompt and then imported it to the eclipse.But i found that most of the important files are in aj extension.How can i change these files into java files.I want to do this in eclipse.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦醒时光 2025-01-15 05:54:49

如果您希望 .aj 文件显示在 Project Explorer 中:

  1. 单击 Project Explorer 面板右上角的向下箭头。
  2. 选择自定义视图...
  3. 过滤器选项卡中,取消选中隐藏生成的Spring Roo ITD

(我发现此问题正在搜索如何执行此操作,所以我写在这里)

If you want the .aj files to show up in the Project Explorer:

  1. Click on the down arrow on the top right corner of the Project Explorer panel.
  2. Choose Customize View...
  3. In the Filters tab, uncheck Hide generated Spring Roo ITDs

(I found this question searching for how to do this, so I wrote it here)

少女的英雄梦 2025-01-15 05:54:49

首先,您不必将 .aj 文件转换为 java。它们是 Roo 生成的方面,在 Roo 背后发挥着魔力。

您不应修改或删除 Roo 生成的 .aj 文件。如果您想覆盖它们的行为,您应该将这些方法“推入”重构到必要的 java 文件中,或者您可以简单地在相关 java 文件中创建具有相同方法签名的方法。 Roo 会自动修改 .aj 文件并从 .aj 文件中删除覆盖的方法。请记住,您需要运行 Roo shell 才能发生这种情况,否则下次启动 Roo shell 时就会发生这种情况。

要使用“Push In”重构功能,可以使用 AJDT for eclipse,它通常是 Eclipse 中 AspectJ 相关开发的首选插件。

干杯。

First of all, you do not have to convert the .aj files to java. They are Roo generated aspects which does the magic behind Roo.

You should not modify or delete Roo generated .aj files. If you want to override the behavior of them, you should "Push In" refactor the methods to the necessary java files or you can simply create methods with the same method signature in the related java file. Roo will automatically modify the .aj file and remove the overridden method from the .aj file. Remember, you need to have the Roo shell running in order for this to happen or it would happen the next time you start the Roo shell.

To use the "Push In" refactoring feature, you can use AJDT for eclipse, which is often the preferred plugin for AspectJ related development in Eclipse.

Cheers.

执妄 2025-01-15 05:54:49

.aj 文件不是 Java 文件。它们是 AspectJ 文件。这些可以被删除,并且所有内容都可以移动到Java文件中但是您将无法继续使用 Roo 来处理项目更改。

Eclipse 有一些插件可以处理 IDE 中的这些文件。我主要使用 SpringSource Tool Suite,它是 Eclipse 的打包版本,具有(以及其他功能)物)与 Roo 一起工作的适当工具。

.aj files are not Java files. They are AspectJ files. These can be removed and everyhting can be moved into Java files but you won't be able to continue using Roo to handle the project changes.

There are plugins for Eclipse to handle those files from the IDE. I've mostly used the SpringSource Tool Suite which is a packaged version of Eclipse that has (among other things) the proper tools to work with Roo.

弥繁 2025-01-15 05:54:49

这些aspectJ文件由Roo管理,不要碰它们,让Roo去做。

在 STS 或带有 AJDT 插件的 Eclipse 中,您可以使用鼠标右键单击 ->重构-> Push in... 将字段、方法等从 Aspect 移至 Java。

但是,如果 Roo shell 发现您已将 Aspect 中存在的某些内容复制到 Java 文件中,它也会执行相同的操作。

These aspectJ files are managed by Roo, don't touch them, let Roo to do that.

In STS or in Eclipse with AJDT plugin you can use mouse right click -> refactor -> push in... To move fields, methods and so on from the Aspect to the Java.

But the Roo shell will do the same if it finds you have copied something that exists in the Aspect to the Java file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文