aspectj weaving已经为war web应用程序编译了JAR工件

时间:2018-04-03 12:22:23

标签: jar war external aspectj-maven-plugin

我试图挥动org.apache.camel-camel-xmpp-2.20.2.jar maven artifact,以便最终将我的web应用程序(war包装)包含到WEB-INF / lib中。在构建我反编译目标/ my-web-app-explosion-war / WEB-INF / lib / org.apache.camel-camel-xmpp-2.20.2.jar / org / apache / camel / component /之后xmpp / XmppMessage.class希望找到我的修改或至少一些aspecj处理跟踪,但我不知道。

问:为了让org.apache.camel-camel-xmpp-2.20.2.jar根据我的方面改变,我该怎么做?

使用java 8,aspectj 1.8.9。

摘自建筑日志:

[INFO] --- aspectj-maven-plugin:1.10:compile (default) @ ddcapplication-ddcwebservice ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[WARNING] You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
Your processor is: org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl
Lombok supports: sun/apple javac 1.6, ECJ
    <unknown source file>:<no line information>

[WARNING] advice defined in org.apache.camel.component.xmpp.XmppMessageAspect has not been applied [Xlint:adviceDidNotMatch]
    /home/adrianpetre/SAGS/DDCWorkspace/ddc/ddcapplication/ddcwebservice/src/main/java/org/apache/camel/component/xmpp/XmppMessageAspect.aj:16

的src /主/ JAVA /组织/阿帕奇/骆驼/组件/ XMPP / XmppMessageAspect.aj:

package org.apache.camel.component.xmpp;

public aspect XmppMessageAspect {
    pointcut newInstancePointcut():
            call(public * org.apache.camel.component.xmpp.XmppMessage.newInstance());

    Object around(): newInstancePointcut() {
        return new XmppMessage();
    }
}

的src /主/资源/ META-INF / aop.xml文件:

<aspectj>
    <weaver options="-verbose -showWeaveInfo">
        <include within="org.apache.camel.component.xmpp.XmppMessage"/>
    </weaver>

    <aspects>
        <aspect name="XmppMessageAspect"/>
    </aspects>
</aspectj>

AspectJ的行家-插件:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <configuration combine.self="override">
        <verbose>true</verbose>
        <showWeaveInfo>true</showWeaveInfo>
        <privateScope>true</privateScope>
        <source>${maven.compiler.source}</source>
        <target>${maven.compiler.target}</target>
        <complianceLevel>${maven.compiler.target}</complianceLevel>
        <xmlConfigured>src/main/resources/META-INF/aop.xml</xmlConfigured>
        <weaveMainSourceFolder>false</weaveMainSourceFolder>
        <weaveDependencies>
            <weaveDependency>
                <groupId>org.apache.camel</groupId>
                <artifactId>camel-xmpp</artifactId>
            </weaveDependency>
        </weaveDependencies>
    </configuration>
    <executions>
        <execution>
            <phase>process-resources</phase>
            <!-- 
                I tried with these too: 
                generate-resources, compile, prepare-package, package 
            -->
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

我的pom.xml包括:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-xmpp</artifactId>
    <version>2.20.2</version>
    <exclusions>
        <exclusion>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
</dependency>

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjtools</artifactId>
</dependency>

0 个答案:

没有答案