component lookup exception with org.apache.maven.repository.RepositorySystem in Maven plugin testing

前端 未结 3 1217
囚心锁ツ
囚心锁ツ 2020-12-16 09:54

I\'m trying to use maven-plugin-testing-harness version 2.1 with the following test case:

public class FooTest extends AbstractMojoTestCase {
           


        
相关标签:
3条回答
  • 2020-12-16 10:29

    Leaving this here for anyone who runs into this problem in the future:

    smoke's answer does work, but make sure the versions of the dependencies included in yegor256's in the original question match. Adding org.apache.maven:maven-compat did not work for me until I had changed those 4 dependencies to also have version 3.0.5.

    0 讨论(0)
  • 2020-12-16 10:41

    Recently I faced the same exception. After a bit researching I found that maven-compat plugin solves the problem:

    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-compat</artifactId>
        <version>3.0.5</version>
        <scope>test</scope>
    </dependency>
    
    0 讨论(0)
  • 2020-12-16 10:41

    Currently, the class org.apache.maven.repository.RepositorySystem is found in the lib maven-resolver-api. If after adding maven-compat, anybody here still gets the error, make sure to add maven-resolver-api artifact as dependency as well.

    <dependency>
      <groupId>org.apache.maven.resolver</groupId>
      <artifactId>maven-resolver-api</artifactId>
      <version>1.3.1</version>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题