Hi Karl Heinz,
you also need to use Plexus Component Annotations[1], resulting in:
@org.codehaus.plexus.component.annotations.Component(
role=WindowsExecutableExtension, hint="default")
public class DefaultWindowsExecutableExtensions implements
WindowsExecutableExtension
Just like Maven Plugin annotations you need to generate the descriptor[2]
Most of the time plugins and components are separated, but it's possible
to use them both in the plugin.
You should recognize the usage ;)
Robert
[1]
http://plexus.codehaus.org/plexus-containers/plexus-component-annotations/
[2] http://plexus.codehaus.org/plexus-containers/plexus-component-metadata/
Op Sun, 30 Mar 2014 20:37:34 +0200 schreef Karl Heinz Marbaise
<khmarba...@gmx.de>:
Hi,
currently i'll try to use the DI things of Maven and simply failing...to
use it...
I just simply wan't to use a class in a Maven plugin.
So in my plugin i would like to do a thing like this:
...
import org.apache.maven.plugins.annotations.Component;
...
@Component
private WindowsExecutableExtension special;
My interface looks like this:
public interfacte WindowsExecutableExtension {
String ROLE = WindowsExecutableExtension.class.getName();
...
}
So my class DefaultWindowsExecutableExtension.java implements the
interface WindowsExecutableExtension and it looks like this:
public class DefaultWindowsExecutableExtensions
implements WindowsExecutableExtension
{
...
public DefaultWindowsExecutableExtensions() {
...
}
}
So i expected to get injected the class instantiated by the default
constructor (non parameters)...
But currently i allways get the following:
[DEBUG] Configuring mojo
org.codehaus.mojo:exec-maven-plugin:1.3-SNAPSHOT:exec from plugin realm
ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.3-SNAPSHOT,
parent: sun.misc.Launcher$AppClassLoader@3f610944]
[WARNING] Error injecting: org.codehaus.mojo.exec.ExecMojo
com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for
org.codehaus.mojo.exec.WindowsExecutableExtension was bound.
while locating org.codehaus.mojo.exec.ExecMojo
I assume that i make a very simple mistake but i don't see it ?
Can someone enlighten me ?
Thanks in advance...
Kind regards
Karl-Heinz Marbaise
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email