如何确保Spring Roo生成的方面由相关项目编织而成? [英] How can I make sure that aspects generated by Spring roo are woven by a dependent project?

查看:280
本文介绍了如何确保Spring Roo生成的方面由相关项目编织而成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Spring Roo 多模块项目.我注意到,在另一个项目中包含了包含我的域模型的jar/模块之后,这些方面没有被编织让我没有任何可用的getter/setters .

I have a Spring Roo multi module project. I noticed that after including the jar/module containing my domain model in another project, the aspects had not been woven leaving me with domain classes without any usable getters/setters.

如何确保Spring roo生成的方面由相关项目编织而成?

编辑:为了能够在另一个项目中使用Roo的方面,需要在相关项目中包含AspectJ插件.请注意,不需要那种方式的编译时加载.

EDIT: In order to be able to use Roo's aspects from another project, one needs to include the aspectJ plugin in the dependent project. Note that compile time loading is not needed that way.

推荐答案

您需要在pom中包括AspectJ Maven插件:

You need to include the aspectj maven plugin in the pom:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>1.4</version>
            <!-- NB: do not use 1.3 or 1.3.x due to MASPECTJ-90 and do not use 1.4
                due to declare parents issue -->
            <dependencies>
                <!-- NB: You must use Maven 2.0.9 or above or these are ignored (see
                    MNG-2972) -->
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjrt</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjtools</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>
                    </goals>
                    <!-- NB: force aspect compile before normal compile, required for 1.3+
                        see: MASPECTJ-13, MASPECTJ-92 -->
                    <phase>process-sources</phase>
                </execution>
            </executions>
            <configuration>
                <outxml>true</outxml>
                <aspectLibraries>
                    <aspectLibrary>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-aspects</artifactId>
                    </aspectLibrary>
                </aspectLibraries>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>

这篇关于如何确保Spring Roo生成的方面由相关项目编织而成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆