使用Maven插件测试中的org.apache.maven.repository.RepositorySystem进行组件查找exception
我正在尝试使用maven-plugin-testing-harness
2.1版以及以下测试用例:
public class FooTest extends AbstractMojoTestCase { @Override protected void setUp() throws Exception { super.setUp(); } public void testSomething() throws Exception { // todo } }
setUp()
调用测试失败:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException role: org.apache.maven.repository.RepositorySystem roleHint: at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239) at org.codehaus.plexus.PlexusTestCase.lookup(PlexusTestCase.java:206) at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:118) at foo.FooTest.setUp(FooTest.java:54)
我在pom.xml
中的这些依赖项:
org.apache.maven maven-plugin-api 3.0.5 org.apache.maven maven-model 3.0.5 org.apache.maven maven-core 3.0.5 org.apache.maven.plugin-testing maven-plugin-testing-harness 2.1 test
有任何想法吗?
最近我遇到了同样的例外。 经过一番研究后,我发现maven-compat插件解决了这个问题:
org.apache.maven maven-compat 3.0.5 test
将此留给今后遇到此问题的任何人:
smoke的答案确实有效,但要确保原始问题中yegor256中包含的依赖项版本匹配。 添加org.apache.maven:maven-compat对我来说不起作用,直到我将这4个依赖项更改为3.0.5版本。
- Java显示数字的Prime Factorization
- 在ThreadLocalRandom上随机
- java图像白色提取
- Solr:如何动态提升有限数量的文件? 是否要修改QueryElevationComponent?
- 为什么24 * 60 * 60 * 1000 * 1000除以24 * 60 * 60 * 1000在Java中不等于1000?
- Java将字符添加到字符串中
- java.lang.SecurityException:类“org.apache.log4j.Logger”与同一包中其他类的信任级别不匹配
- 如何在Hibernate中返回特定类型的列表而不是List ?
- Java / Tomcat被黑了