[forge-dev] creation and test of a forge addon
George Gastaldi
ggastald at redhat.com
Sun Aug 31 21:34:07 EDT 2014
Hi Raquel,
Sorry about that, it seems we are experiencing some issues in our infrastructure, we'll fix it asap.
About your questions:
1) you need to get the MavenPluginFacet from the Project instance. In your execute() method (assuming your command extends AbstractProjectUICommand), do:
Project project = getSelectedProject(context);
MavenPluginFacet facet = project.getFacet(MavenPluginFacet.class);
facet.addPlugin(...);
2) I haven't fully understood this, could you clarify with an example please?
I am replying from my phone, so I am not sure if the methods/classes in the example given matches.
Best Regards,
George
> Em 31/08/2014, às 18:38, Raquel Pau Fernández <raquelpau at gmail.com> escreveu:
>
> Hi,
>
> Your link was broken. However, I have followed the "How to create a JBoss Forge Addon" of Arun Gupta from http://vimeo.com/jbossdeveloper.
>
> Currently, I have created an addon, the commands and I have installed my addon in my local Forge. All runs perfect! :)
>
> My addon allows:
>
> 1) To Install walkmod: Creates a fixed walkmod.xml and adds a Maven plugin declaration into the user pom.xml.
> 2) To run walkmod: It will run walkmod if it is installed. Otherwise it will run an embedded version.
> 3) To create a walkmod plugin: I need to create a default implementation of a java class that extends an specific class.
>
> So, I have 2 questions:
> 1) How can I modify the current pom.xml of the user?
> 2) How can I create a default implementation of a java class file using the Forge API?
>
> Thanks
>
>
>
> 2014-08-27 0:57 GMT+02:00 George Gastaldi <ggastald at redhat.com>:
>> Hi Raquel,
>>
>> The stacktrace doesn't show much. See if anything else is displayed oin the logs.
>>
>> In order to create a command in Forge, you need to use the UI addon services. Take a look on:
>> http://forge.jboss.org/addon/org.jboss.forge.addon:ui
>>
>> Let me know how it goes.
>>
>> Em 26/08/2014, às 14:03, Raquel Pau Fernández <raquelpau at gmail.com> escreveu:
>>
>>> Hi,
>>>
>>> 1) the full stacktrace is printed below.
>>>
>>> 2) I am using as you have mentioned, the version: 2.8.0.Final. Which version do you recommend me?
>>>
>>> 3) What do I mean about POJOs: I have coded a facade controller to run the walkmod (http://www.walkmod.com) commands - and my plugin is about running walkmod from forge. So, I would like to know how to link forge with my facade methods / walkmod commands. In other words, I would like to know if exists some place to configure it or the names of my facade methods must follow some sort of conventions.
>>>
>>> Thanks,
>>>
>>> ----------------------------Stacktrace----------------------------------
>>> java.lang.IllegalStateException: Test runner could not locate test class [org.walkmod.forge.WalkmodAddonTest] in any deployed Addon.
>>> at org.jboss.forge.arquillian.ForgeTestMethodExecutor.invoke(ForgeTestMethodExecutor.java:234)
>>> at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:109)
>>> 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:606)
>>> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
>>> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
>>> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
>>> at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
>>> at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:57)
>>> 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:606)
>>> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
>>> at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
>>> at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129)
>>> 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:606)
>>> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>> at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:102)
>>> 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:606)
>>> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>> at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:84)
>>> 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:606)
>>> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>> at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:65)
>>> 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:606)
>>> at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
>>> at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
>>> at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
>>> at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
>>> at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:294)
>>> at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:269)
>>> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
>>> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
>>> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>>> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
>>> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
>>> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
>>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
>>> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
>>> at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:193)
>>> at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:345)
>>> at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:49)
>>> at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:207)
>>> at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>>> at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:155)
>>> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>>
>>>
>>>
>>> 2014-08-26 18:15 GMT+02:00 George Gastaldi <ggastald at redhat.com>:
>>>> Hi Raquel,
>>>>
>>>> Do you see any stacktraces? Starting from Forge 2.8.0.Final the cause should be displayed as a cause in the exception you are experiencing.
>>>> I am not sure about your other question. What POJOs are you talking about? Can you clarify?
>>>>
>>>> Best Regards,
>>>>
>>>> George Gastaldi
>>>>
>>>>
>>>>
>>>>
>>>>> On 08/26/2014 03:18 AM, Raquel Pau Fernández wrote:
>>>>> Hi,
>>>>>
>>>>> I would like to create a forge addon and I have followed the documentation.
>>>>>
>>>>> I am in the test section of http://forge.jboss.org/document/develop-an-addon and I have the following Exception when I run the first test code from .
>>>>>
>>>>> java.lang.IllegalStateException: Test runner could not locate test class [.....] in any deployed Addon.
>>>>>
>>>>> Obviously, the test needs to fail, but I suspect that I cannot write tests in the same forge addon project. Am I right? How can I correct this Exception?
>>>>>
>>>>> Another question, how does forge link my Forge POJOs with the forge commands?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Raquel Pau
>>>>>
>>>>> "Education is the most powerful weapon which you can use to change the world"
>>>>> Nelson Mandela
>>>>>
>>>>> personal page:
>>>>> http://sites.google.com/site/raquelpau/
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> forge-dev mailing list
>>>>> forge-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> forge-dev mailing list
>>>> forge-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>>
>>>
>>>
>>> --
>>> Raquel Pau
>>>
>>> "Education is the most powerful weapon which you can use to change the world"
>>> Nelson Mandela
>>>
>>> personal page:
>>> http://sites.google.com/site/raquelpau/
>>> _______________________________________________
>>> forge-dev mailing list
>>> forge-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>
>
>
> --
> Raquel Pau
>
> "Education is the most powerful weapon which you can use to change the world"
> Nelson Mandela
>
> personal page:
> http://sites.google.com/site/raquelpau/
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20140831/620d15a0/attachment-0001.html
More information about the forge-dev
mailing list