4 Replies Latest reply on May 6, 2013 7:20 PM by lincolnthree

    Cannot create Project from DirectoryResource - MavenProjectLocator

      Hello,

       

      I am trying to create a plugin where I can work with a multiproject project.

      While I want to traverse the projects to find one with a specific artifact Id I injected a  MavenProjectLocator into my Facet class (I guess this is the only way I can get a project from a DirectoryResource or?)

       

       

      Injected into my Facet like this:

       

      @Alias("camelroutefacet")

      @RequiresFacet({ MavenCoreFacet.class, JavaSourceFacet.class,

                DependencyFacet.class })

      public class CamelRoutePrjFacet extends BaseFacet {

       

      @Inject

      MavenProjectLocator projectLocator;

       

      But to get this to compile I had to remove the test scope for the forge-shell artifact.

       

      <dependency>

        <groupId>org.jboss.forge</groupId>

        <artifactId>forge-shell</artifactId>

        <scope>provided</scope>

      </dependency>

       

      Now when I run the plugin I get the follwoing error, I guess it is because the MavenProjectLocator  cannot be injected.

      If this is the case, how do I get the MavenProjectLocator  into my project ?

       

      Error I receive:

       

      org.jboss.forge.project.facets.FacetNotFoundException: The requested Facet of type [se.miman.forge.easyprj.facet.CamelRo

      utePrjFacet] could not be loaded.

              at org.jboss.forge.project.services.FacetFactory.getFacet(FacetFactory.java:102)

              at org.jboss.forge.shell.project.FacetInstallationHandler.installRequest(FacetInstallationHandler.java:56)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)

              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)

              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)

              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)

              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)

              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)

              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)

       

       

              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)

              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)

              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)

              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)

              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:628)

              at org.jboss.weld.event.EventImpl.fire(EventImpl.java:75)

              at se.miman.forge.easyprj.CamelRoutePlugin.setup(CamelRoutePlugin.java:52)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.jboss.forge.shell.command.Execution.perform(Execution.java:141)

              at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:109)

              at org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:47)

              at org.jboss.forge.shell.ShellImpl$ExecutorThread.run(ShellImpl.java:789)

              at org.jboss.forge.shell.ShellImpl.execute(ShellImpl.java:812)

              at org.jboss.forge.shell.ShellImpl.doShell(ShellImpl.java:602)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)

              at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)

              at org.jboss.forge.shell.ShellImpl$Proxy$_$$_WeldClientProxy.doShell(ShellImpl$Proxy$_$$_WeldClientProxy.java)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)

              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)

              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)

              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)

              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)

              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)

              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)

       

       

              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)

              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)

              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)

              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)

              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)

              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616)

              at org.jboss.forge.shell.Bootstrap$1.run(Bootstrap.java:172)

              at java.lang.Thread.run(Thread.java:722)