2

I am using maven-aspectJ plugin in a maven project. I want to weave the cucumber-java library. When I run maven, I constantly get

[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] 

My plugin is configured as follows:

<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> 

I checked the pom.xml and the dependency is there. What am I missing here?

1 Answer 1

2

Your <weaveDependency> should refer to dependencies already defined in your pom.xml. Have you done that under <dependencies>? Like this:

<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> 

See also AspectJ Maven plugin documentation.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, I did that. I confirmed the dependency is there.
Then post the full POM and, if necessary, some minimal sample code to clearly reproduce the problem.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.