[forge-dev] creation and test of a forge addon

Raquel Pau Fernández raquelpau at gmail.com
Mon Sep 1 16:56:36 EDT 2014


Thanks for your help!

Perfect.

Right now, I have a little problem building the plugin because when I build
the project (with Forge - using addon-build-and-install or just with
mvn-install) the process never ends..Constantly, mvn is creating the .dot
file.

If you don't know what is happeing I will start again from the scratch.

If it can help you, my mvn version is 3.2.2

The output of mvn is as follows:
....
Configuring mojo
org.jboss.forge.furnace:furnace-maven-plugin:2.8.1.Final:generate-dot from
plugin realm
ClassRealm[plugin>org.jboss.forge.furnace:furnace-maven-plugin:2.8.1.Final,
parent: sun.misc.Launcher$AppClassLoader at 2bbd86]
[DEBUG] Configuring mojo
'org.jboss.forge.furnace:furnace-maven-plugin:2.8.1.Final:generate-dot'
with basic configurator -->
[DEBUG]   (f) attach = true
[DEBUG]   (f) classifier = forge-addon
[DEBUG]   (f) includeTransitiveAddons = true
[DEBUG]   (f) outputDirectory =
C:\Users\rpau\workspace\walkmod\walkmod\target\classes/META-INF/resources
[DEBUG]   (f) settings = org.apache.maven.execution.SettingsAdapter at fb8996
[DEBUG]   (f) mavenProject = MavenProject:
org.walkmod.forge.addon:walkmod:1.0.0-SNAPSHOT @
C:\Users\rpau\workspace\walkmod\walkmod\pom.xml
[DEBUG] -- end configuration --
[INFO] Generating
C:\Users\rpau\workspace\walkmod\walkmod\target\classes\META-INF\resources\walkmod-1.0.0-SNAPSHOT.dot
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for
C:\Users\rpau\.m2\repository
[DEBUG] Skipped remote update check for
org.walkmod.forge.addon:walkmod:1.0.0-SNAPSHOT/maven-metadata.xml, locally
installed metadata up-to-date.
[DEBUG] Skipped remote update check for
org.walkmod.forge.addon:walkmod:1.0.0-SNAPSHOT/maven-metadata.xml, locally
installed metadata up-to-date.
[DEBUG] Skipped remote update check for
org.walkmod:walkmod-cmd/maven-metadata.xml, locally cached metadata
up-to-date.
[DEBUG] Skipped remote update check for
org.walkmod:walkmod-core/maven-metadata.xml, locally cached metadata
up-to-date.
[DEBUG] Skipped remote update check for
org.walkmod:merger/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=128,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=28,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1,
ConflictResolver.conflictItemCount=49,
DefaultDependencyCollector.collectTime=162,
DefaultDependencyCollector.transformTime=1}
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=159,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=37,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2,
ConflictResolver.conflictItemCount=159,
DefaultDependencyCollector.collectTime=294,
DefaultDependencyCollector.transformTime=3}
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=52,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=24,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0,
ConflictResolver.conflictItemCount=35,
DefaultDependencyCollector.collectTime=151,
DefaultDependencyCollector.transformTime=1}
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=2,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=2,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0,
ConflictResolver.conflictItemCount=2,
DefaultDependencyCollector.collectTime=6,
DefaultDependencyCollector.transformTime=0}
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=23,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=23,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0,
ConflictResolver.conflictItemCount=23,
DefaultDependencyCollector.collectTime=8,
DefaultDependencyCollector.transformTime=0}
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=157,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=36,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2,
ConflictResolver.conflictItemCount=157,
DefaultDependencyCollector.collectTime=10,
DefaultDependencyCollector.transformTime=2}
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0,
ConflictMarker.markTime=0, ConflictMarker.nodeCount=10,
ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0,
ConflictIdSorter.conflictIdCount=10,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1,
ConflictResolver.conflictItemCount=10,
DefaultDependencyCollector.collectTime=41,
DefaultDependencyCollector.transformTime=1}
...continues in the same way...

Thanks
......



2014-09-01 19:00 GMT+02:00 George Gastaldi <ggastald at redhat.com>:

>  Cool,
>
> To generate a JavaSource file is easy:
>
>       String fqn = "com.george.app.MyClass";
>       String packageName =
> org.jboss.forge.roaster.model.util.Types.getPackage(fqn);
>       String typeName =
> org.jboss.forge.roaster.model.util.Types.toSimpleName(fqn);
>       JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
>       JavaClassSource source =
> Roaster.create(JavaClassSource.class).setPackage(packageName)
>                .setName(typeName).setSuperClass(MySuperClass.class);
>       facet.saveJavaSource(source);
>
> Best Regards,
>
> George
>
>
> On 09/01/2014 01:04 PM, Raquel Pau Fernández wrote:
>
> Hi,
>
>  Perfect, it was what I need for the first question!
>
>  About the second question: I would like to generate a Java source file.
> This java source file has a qualified name given by the user, and must be
> generated extending from an specific subclass. So, how can I do that with
> Forge?
>
>  Thanks
>
>  Best regards,
>
>
>
> 2014-09-01 3:34 GMT+02:00 George Gastaldi <ggastald at redhat.com>:
>
>>  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 listforge-dev at lists.jboss.orghttps://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
>>
>>
>> _______________________________________________
>> 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 listforge-dev at lists.jboss.orghttps://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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20140901/d3705367/attachment-0001.html 


More information about the forge-dev mailing list