【发布时间】:2014-03-02 03:43:23
【问题描述】:
我们正在使用 Maven AspectJ 插件来构建我们的 Web 应用程序。它利用“weaveDependencies”向一些依赖jar文件添加方面。
现在我们在 Web 应用程序存档中得到了一些类的两个版本,一个在 WEB-INF/classes 中,一个在 WEB-INF/lib 的原始 jar 文件中。好像只有classes里面的那个有aspect。
恐怕这会引起问题。
解决此问题的最佳方法是什么?
讨论了同样的问题(没有解决方案)over at the Eclipse forums。
整个 pom.xml 本身就很大,当然包含的子项目也有自己的。我希望以下 WAR 项目的摘录能够提供足够的信息。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<filters>
<filter>${basedir}/src/etc/${environment}/environment.properties</filter>
</filters>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.2</version> <!-- NB: do use 1.3 or 1.3.x due to MASPECTJ-90 - wait for 1.4 -->
<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>
</execution>
</executions>
<configuration>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<weaveDependencies>
<weaveDependency>
<groupId>OURPROJECT</groupId>
<artifactId>OURPROJECT-api</artifactId>
</weaveDependency>
<weaveDependency>
<groupId>OURPROJECT</groupId>
<artifactId>OURPROJECT-service</artifactId>
</weaveDependency>
</weaveDependencies>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
【问题讨论】:
-
请出示你的 pom 文件?
-
@khmarbaise:添加了摘录,希望对您有所帮助。