Error injecting DefaultRepositorySystem in maven-plugin-testing-harness

久未见 提交于 2019-12-23 07:51:07

问题


I am trying to create a new maven (3.0.3) plugin based on an existing (2.0) plugin, and facilitating aether to pickup some dependencies.

I tried to create a simple test to load the mojo using the maven-plugin-testing-harness (version 2.0.1), but lookupMojo fails with a guice exception:

1) Error injecting: org.sonatype.aether.impl.internal.DefaultRepositorySystem
at ClassRealm[plexus.core, parent: null]
at ClassRealm[plexus.core, parent: null]
while locating org.sonatype.aether.RepositorySystem
while locating org.codehaus.griffon.maven.plugin.MvnValidateMojo
at ClassRealm[plexus.core, parent: null]
while locating org.apache.maven.plugin.Mojo annotated with @com.google.inject.name.Named(value=org.codehaus.griffon:griffon-maven-plugin:1.3.0-SNAPSHOT:validate)

This of course is because I need to reference the repository system at some point, but not right now:

@Component
private RepositorySystem repoSystem;

I have tried (actually started with) version 2.1, but got the problem in the AbstractMojoTestCase#setUp() method.

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:247)

Either way, Not sure what I need to include and where to do a vanilla mojo load test similar to the cookbook. Anybody got any ideas?

来源:https://stackoverflow.com/questions/14939341/error-injecting-defaultrepositorysystem-in-maven-plugin-testing-harness

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!