Eclipse 中的 Maven/AJDT 项目

发布于 2024-11-17 20:52:17 字数 202 浏览 2 评论 0原文

我需要在maven项目中使用aspectj。我安装了 Eclipse (m2e) 的 Maven 插件、Maven AspectJ 插件以及 Eclipse 的 AJDT。所以现在,当我打开一个新项目时,我有“Maven Project”和“AspectJ Project”。我怎样才能创建一个新项目 Maven AspectJ 项目? 我没有找到任何参考资料,所以你是我唯一的希望。 谢谢

I need to use aspectj in a maven project. I installed the maven plugin for eclipse (m2e), the maven aspectj plugin, and also AJDT for Eclipse. So now, when i open a new project i have "Maven Project" and "AspectJ Project". how can i make a new project that is Maven AspectJ project?
I did not found any reference for that, so you are my only hope.
thanks

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

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

发布评论

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

评论(6

倦话 2024-11-24 20:52:17
  1. 转到帮助>安装新软件...
  2. 使用此软件存储库:http://dist.springsource.org/release /AJDT/configurator/
  3. 安装 AJDT m2e 配置器

源:http://blog.springsource.com/2011/10/18/upgrading-maven-integration-for-springsource-tool-suite-2-8-0/#comment-207264 (安德鲁·艾森伯格)

  1. Go to Help > Install New Software...
  2. Use this software repository: http://dist.springsource.org/release/AJDT/configurator/
  3. Install the AJDT m2e Configurator

Source: http://blog.springsource.com/2011/10/18/upgrading-maven-integration-for-springsource-tool-suite-2-8-0/#comment-207264 (Andrew Eisenberg)

南…巷孤猫 2024-11-24 20:52:17

您应该将 maven-aspectj-plugin 添加到 pom.xml 中的构建插件部分,如下所示:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <executions>
      <execution>
        <goals>
          <!-- use this goal to weave all your main classes -->
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <complianceLevel>1.6</complianceLevel>
    </configuration>
  </plugin>

You should add the maven-aspectj-plugin to your build plugins section in your pom.xml as in:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <executions>
      <execution>
        <goals>
          <!-- use this goal to weave all your main classes -->
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <complianceLevel>1.6</complianceLevel>
    </configuration>
  </plugin>
ι不睡觉的鱼゛ 2024-11-24 20:52:17

检查 m2eclipse 的 AJDT 项目配置器

m2eclipse-AJDT 插件检测到 pom.xml 包含 aspectj-maven-plugin 并自动添加相关的 AJDT 在 Eclipse 中导入项目时的性质和配置。

我认为已经为该插件与 m2eclipse 0.12 版本一起工作做了一些努力,不知道它是否有效。

我已经使用 m2eclipse 0.10 尝试过该插件,效果很好。

请参阅 GitHub m2eclipse-ajdt 项目
请参阅将 AJDT 集成移出主 m2e 源代码树

Check AJDT project configurator for m2eclipse

The m2eclipse-AJDT plugin detect that the pom.xml contains the aspectj-maven-plugin and add automatically the relevant AJDT nature and configuration to the project when importing it in eclipse.

I think some effort have bean made for the plugin to work with version 0.12 of m2eclipse , dont know if it's worked.

I already try the plugin with m2eclipse 0.10 and it worked well.

See GitHub m2eclipse-ajdt project
See Move AJDT integration out of main m2e source tree

这个俗人 2024-11-24 20:52:17
  1. 首先我们需要确保eclipse安装了AJDT(AspectJ开发工具)。查看适合您的 Eclipse 的最新或适当版本的 AJDT。 (http://www.eclipse.org/ajdt/)
  2. 其次使用以下命令安装“AJDT m2e Configurator”此存储库 http://dist.springsource.org/release/AJDT/configurator/ (作为亨迪如上所述)。
  3. 如果您之前安装过m2eclipse,则需要在执行步骤2之前将其卸载。
  1. Firstly we need to make sure AJDT (AspectJ development tools) is installed for eclipse. Check out the latest or appropriate version of AJDT for your Eclipse. (http://www.eclipse.org/ajdt/)
  2. Secondly install "AJDT m2e Configurator" using this repository http://dist.springsource.org/release/AJDT/configurator/ (As Hendy described above).
  3. If you have previously installed m2eclipse, you need to uninstall it before performing step 2.
哑剧 2024-11-24 20:52:17

在 maven pom.xml 中添加 AspectJ 支持后,您必须将相关项目方面添加到 Eclipse 中的项目配置中。

You will have to add the relevant project facets to your project configuration in eclipse after adding the AspectJ support in your maven pom.xml.

倾城泪 2024-11-24 20:52:17

如果您的 pom.xml 中有aspectj-maven-plugin,您将缺少一个 m2e 连接器:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>1.11</version>
            <configuration>
                <includes>
                    <include>**/*aj</include>
                    <include>**/*java</include>
                </includes>
                <Xlint>ignore</Xlint>
                <source>1.8</source>
                <target>1.8</target>
                <complianceLevel>1.8</complianceLevel>
                <showWeaveInfo>true</showWeaveInfo>
                <weaveDependencies>
                    <weaveDependency>
                        <groupId>org.perf4j</groupId>
                        <artifactId>perf4j</artifactId>
                        <classifier>log4jonly</classifier>
                    </weaveDependency>
                </weaveDependencies>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

我必须在 eclipse 中安装 m2e AJDT maven 插件配置器,但它一开始不起作用,因为我缺少依赖项。
因此,要开始安装此站点上提供的 AJDT 工具: http://download .eclipse.org/tools/ajdt/48/dev/update/
重新启动 eclipse,然后 m2e AJDT maven 插件配置器的安装应该可以工作。重新启动后,您应该可以使用 eclipse 来构建您的aspectj 类。

If you have the aspectj-maven-plugin in your pom.xml you'll get one missing m2e connector :

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>1.11</version>
            <configuration>
                <includes>
                    <include>**/*aj</include>
                    <include>**/*java</include>
                </includes>
                <Xlint>ignore</Xlint>
                <source>1.8</source>
                <target>1.8</target>
                <complianceLevel>1.8</complianceLevel>
                <showWeaveInfo>true</showWeaveInfo>
                <weaveDependencies>
                    <weaveDependency>
                        <groupId>org.perf4j</groupId>
                        <artifactId>perf4j</artifactId>
                        <classifier>log4jonly</classifier>
                    </weaveDependency>
                </weaveDependencies>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

I had to install m2e AJDT maven plugin configurator in eclipse but it did not work at first because I had missing dependencies.
So to start install the AJDT tool available on this site : http://download.eclipse.org/tools/ajdt/48/dev/update/
Restart eclipse and then the install of m2e AJDT maven plugin configurator should work. After a new restart you should have eclipse available to build your aspectj classes.

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