我正在使用aop,可以借助eclipse aop插件发布apk。正如您已经知道的,在aop中,在编译时必须将大量代码添加到一些预先声明的类中。
但是如果我想通过 jenkins + maven 自动化这个操作,我不知道该怎么做。需要明确的是,我想将整个编译(打包)问题转移到 jenkins + maven 平台上。 Maven 应该构建应用程序,但是如何构建?
最佳答案
使用aspectj maven插件。确保您的编译器插件排除您的方面,而aspectj编译器插件仅编译方面。像这样的东西:
<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>
关于java - AOP + Jenkins + Maven 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21522146/