简体   繁体   English

AOP + Jenkins + Maven集成

[英]AOP + Jenkins + Maven Integration

I am using aop and can publish the apk with the help of eclipse aop plugin. 我正在使用aop,可以在eclipse aop插件的帮助下发布apk。 As you already know in aop, a lot of codes must be added into some pre-stated classes in compiling time. 正如您在aop中已经知道的那样,在编译时必须将许多代码添加到某些预先定义的类中。

But I dont know what to do if I want to automatize this operation via jenkins + maven. 但是我不知道该如何通过jenkins + maven自动执行此操作。 To be clear, I want to transfer the whole compiling (packaging) issues on to jenkins + maven platform. 明确地说,我想将整个编译(打包)问题转移到jenkins + maven平台上。 Maven should build the application but how? Maven应该构建应用程序,但是如何?

Use aspectj maven plugin. 使用AspectJ Maven插件。 Ensure that your compiler plugin excludes your aspects and the aspectj compiler plugin only compiles the aspects. 确保您的编译器插件排除您的方面,而Aspectj编译器插件仅编译方面。 Something like these: 像这样的东西:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
        <encoding>UTF-8</encoding>
        <excludes>
            <exclude>*.aj</exclude>
        </excludes>
    </configuration>
</plugin>


<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.3</version>
    <configuration>
        <verbose>true</verbose>
        <complianceLevel>1.6</complianceLevel>
        <showWeaveInfo>true</showWeaveInfo>
        <sources>
            <source>
                <basedir>src/main/java</basedir>
                <includes>
                    <include>**/*.aj</include>
                </includes>
            </source>
        </sources>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.10</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.6.10</version>
        </dependency>
    </dependencies>
</plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM