有没有“跳过编织旗"?在 Maven?(不包括 AspectJ) [英] Is there "skip weaving flag" in Maven? (exclude AspectJ)

查看:26
本文介绍了有没有“跳过编织旗"?在 Maven?(不包括 AspectJ)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Maven(大量 pom.xml-s)构建我们的多项目应用程序.我们最近引入了 AspectJ,但是我怀疑 AspectJ 会导致性能问题.为了确定起见,这次我想在没有 AspectJ 的情况下构建应用程序并查看它的执行情况.但是我真的不想从 pom.xml 中删除所有与 AspectJ 相关的东西,所以如果有某种标志或可以从构建中排除 AspectJ 的东西会很方便.有吗?
更新:这似乎没有任何效果:-Dmaven.aspectj.skip=true

I build our multi-project application with Maven(lots of pom.xml-s). We recently introduced AspectJ, however I suspect AspectJ contributes to performance problems. In order to be sure, I'd like to build the application this time without AspectJ and see how it performs. But I would not really like to remove all AspectJ related stuff from pom.xml, so it would be handy if there was some kind of flag or something that could exclude AspectJ from build. Is there any?
Update: this does not seem to have any effect: -Dmaven.aspectj.skip=true

推荐答案

如果你想暂时禁用 aspectj-maven-plugin,你可以向父 pom.xml 添加一个配置文件,它取消注册插件的执行(通过将它们分配到阶段 none).可能看起来像这样(如果有,请添加您自己的执行 ID):

If you want to disable the aspectj-maven-plugin temporarily, you could add a profile to the parent pom.xml which deregisters the executions of the plugin (by assigning them to phase none). Could look like this (add your own execution IDs if you have some):

<profile>
    <id>noAspectJ</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>

一个简单的 maven cmd 激活这个:

A simple maven cmd activates this:

mvn clean install -PnoAspectJ

这篇关于有没有“跳过编织旗"?在 Maven?(不包括 AspectJ)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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