我在一个maven项目中使用maven-aspectJ插件。我想编织cucumber-java库。当我运行maven时,我经常得到
[ERROR] Failed to execute goal
org.codehaus.mojo:aspectj-maven-plugin:1.5:compile (default)
on project junitsampler:
The artifact info.cukes:cucumber-java referenced in aspectj plugin as
dependencies and/or directories to weave, is not found the project
dependencies -> [Help 1]我的插件配置如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<!-- <dependencies> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId>
<version>1.7</version> <scope>system</scope> <systemPath>${tools-jar}</systemPath>
</dependency> </dependencies> -->
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
<configuration>
<source>1.7</source>
<complianceLevel>1.7</complianceLevel>
<verbose>true</verbose>
<showWeaveInfo>true</showWeaveInfo>
<target>1.7</target>
<forceAjcCompile>true</forceAjcCompile>
<weaveDirectories>
<weaveDirectory>C:/Users/shenv/workspace/junitsampler/target/classes/cucumber</weaveDirectory>
</weaveDirectories>
<!-- <weaveDependencies> <weaveDependency> <groupId>com.autodesk.dm.wipdata.jmeter</groupId>
<artifactId>junitsampler</artifactId> </weaveDependency> <weaveDependency>
<groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> </weaveDependency> -->
<weaveDependencies>
<weaveDependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
</plugin>我检查了pom.xml,依赖项就在那里。这里我漏掉了什么?
发布于 2014-08-02 18:47:20
您的<weaveDependency>应该引用您的pom.xml中已经定义的依赖项。你在<dependencies>下做过吗?如下所示:
<project>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.1.8</version>
</dependency>
<!-- (...) -->
</dependencies>
<!-- (...) -->
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<!-- (...) -->
<configuration>
<!-- (...) -->
<weaveDependencies>
<weaveDependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>另请参见AspectJ Maven plugin documentation。
https://stackoverflow.com/questions/25087942
复制相似问题