Now it's working!!!!! \o/
Ive downloaded the alpha4(tried SNAPSHOT, Betas 2 and 3 without success)
release and just changed the FORGE_HOME to point to it and solved the
injection problem.
I also had to add
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api</artifactId>
<version>0.1.7</version>
</dependency>
in order to use forge-shell-api 1.0.0-SNAPSHOT.
And finaly added commons-lang-2.4.jar, commons-collections-3.1 to
forge_home/lib
and now i can see "Wrote
/JAVA/Projetos/Conventions/Conventions/ConventionsLayers/src/main/java/com/jsf/conventions/layers/controller/Per
nMBean.java" after my command execution
many thanks for your help, keep the great work!
2011/10/23 Lincoln Baxter, III <lincolnbaxter(a)gmail.com>
Why are you importing @RequestScoped?
It's possible that is breaking something, though I don't see why it would.
It looks like something else is happening in code that you did not show.
Your plugin does not need to be @Scoped.
If this still occurs, try injecting Event<PickupResources> event; instead
of injecting the BeanManager, though I don't see why that would make a
difference either ;)
Hope this helps,
Lincoln
On Sun, Oct 23, 2011 at 4:15 PM, Rafael Pestano <rmpestano(a)gmail.com>wrote:
> Hi Lincon,
>
> yes i got a look at scaffolding plugins project source but for now im
> getting used to forge so the ideia is create some plugins to see how stuff
> works, but thanks for pointing that.
>
> At the moment im trying to understand how resource injection is done in
> Forge cause i cant inject anything in my plugin.
>
> Ive tried to make my plugin a CDI bean but when i execute the command i
> got " WELD-001303 No active contexts for scope type
> javax.enterprise.context.RequestScoped"
>
> here is my plugin(same as arquillian plugin Paul has pointed out but with
> different velocity templete):
http://pastebin.com/nrc3PTz2
> and my pom.xml:
http://pastebin.com/etcQYNt4
>
> 2011/10/23 Lincoln Baxter, III <lincolnbaxter(a)gmail.com>
>
> Hi Rafael!
>>
>> What you want to do sounds really interesting! Have you taken a look at
>> the forge-scaffold-api? Its located as a sub-folder of the github repository
>> that you just cloned.
>>
>> This will let you use the 'scaffold from-entity' command to invoke your
>> code, and it will also let people use the familiar api. We can also make
>> some improvements to that api if you need it :)
>>
>> --
>> Lincoln Baxter's Droid
>>
http://ocpsoft.com
>> "Keep it Simple"
>> On Oct 23, 2011 10:03 AM, "Rafael Pestano" <rmpestano(a)gmail.com>
wrote:
>>
>>> I was meaning just clone it ;)
>>>
>>> Nice to hear about the scaffolding plugin.
>>>
>>> 2011/10/23 Paul Bakker <paul.bakker.nl(a)gmail.com>
>>>
>>>> Hi Rafael,
>>>>
>>>> What do you mean by clone and forge the project? On github you can just
>>>> clone the plugin-arquillian project and start hacking on it.
>>>> Formatting is a bit of a problem, that doesn't work very well now
with
>>>> the builder API. Maybe Lincoln can say more about that?
>>>>
>>>> Note that within a few weeks Forge will have a new scaffolding plugin
>>>> built-in, that does basically something that you are doing in your
plugin.
>>>>
>>>> Paul
>>>>
>>>> On Oct 23, 2011, at 3:45 PM, Rafael Pestano wrote:
>>>>
>>>> I've managed to clone forge repo with this address
>>>>
https://github.com/forge/core.git now, i was using the old
>>>>
github.com/seam/forge.git.
>>>>
>>>> 2011/10/23 Rafael Pestano <rmpestano(a)gmail.com>
>>>>>
>>>>>> Hello Paul, thanks for your enlightening reply.
>>>>>>
>>>>>> The plugin is about a code generator for a home made Java EE6
>>>>>> framework and for instance it will generate very simple xhtml and
java
>>>>>> classes, so for example the generate-controller plugin would
generate
>>>>>>
>>>>>> *@ViewAccessScoped
>>>>>> @Named("personMBean")
>>>>>> public class PersonMBean extends AbstractBaseMBean<Person>
implements
>>>>>> Serializable, ModalObserver {
>>>>>>
>>>>>> @Inject
>>>>>> public void setPersonService(PersonService personService)
{*//service
>>>>>> layer will be generated togheter*
>>>>>> super.setBaseService(personService);
>>>>>> }
>>>>>>
>>>>>> some other very simple methods
>>>>>> }*
>>>>>>
>>>>>> for the controller-plugin maybe i dont need to understand the
model
>>>>>> class (just to import it) cause its just a matter of replacing
parammeters
>>>>>> by the domain object but in the view-plugin it will be necessary
for sure.
>>>>>>
>>>>>> Another concern i have is how to format the generated code? maybe
the
>>>>>> velocity template could help on that.
>>>>>>
>>>>>> Ive seen the Arquillian example, how can i clone it and forge
>>>>>> project?
>>>>>>
>>>>>> Thanks again!
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2011/10/23 Paul Bakker <paul.bakker.nl(a)gmail.com>
>>>>>>
>>>>>>> Hi Rafael,
>>>>>>>
>>>>>>> There are two things you need to do:
>>>>>>> 1) "understand" the Person class
>>>>>>> 2) generate new code
>>>>>>>
>>>>>>>
>>>>>>> 1)
>>>>>>> You can use a command parameter to get the Person
>>>>>>> class: @Option(name = "class", required = true,
type =
>>>>>>> PromptType.JAVA_CLASS) JavaResource classUnderTest
>>>>>>>
>>>>>>> JavaResource is a rich file representation of the class.
>>>>>>> Now you can use the JavaSourceFacet to get information about
the
>>>>>>> class itself:
>>>>>>>
>>>>>>> JavaSourceFacet java =
project.getFacet(JavaSourceFacet.class);
>>>>>>> JavaSource<?> javaSource =
classUnderTest.getJavaSource();
>>>>>>>
>>>>>>> javaSource has methods such as getPackage() etc.
>>>>>>>
>>>>>>> 2)
>>>>>>> Now you have to generate code. There are two ways to do
this,
>>>>>>> depending on your needs.
>>>>>>> The most elegant way is to use the "JavaParser"
builder API:
>>>>>>>
>>>>>>> JavaClass javaClass = JavaParser.create(JavaClass.class)
>>>>>>> .setPackage(entityPackage)
>>>>>>> .setName(entityName)
>>>>>>> .setPublic()
>>>>>>> .addAnnotation(Entity.class).getOrigin()
>>>>>>> .addInterface(Serializable.class);
>>>>>>> Field<JavaClass> id = javaClass.addField("private
Long id =
>>>>>>> null;");
>>>>>>> ….
>>>>>>>
>>>>>>> My experience is that this works best for small classes. If
you need
>>>>>>> to generate a lot of code it might be better to use a
tempting framework
>>>>>>> such as Apache Velocity.
>>>>>>> You can find an example of this in the code of the
Arquillian
>>>>>>> plugin:
>>>>>>>
https://github.com/forge/plugin-arquillian/blob/master/src/main/java/org/...
>>>>>>>
>>>>>>> You can just add Velocity to your pom file and it will work.
>>>>>>>
>>>>>>> If you have any more questions, let us know! What kind of
plugin are
>>>>>>> you writing?
>>>>>>>
>>>>>>> Paul Bakker
>>>>>>>
>>>>>>>
>>>>>>> On Oct 23, 2011, at 2:26 AM, Rafael Pestano wrote:
>>>>>>>
>>>>>>> Hi everyone,
>>>>>>>
>>>>>>> this is my first mail to this list and id like to
congratulate the
>>>>>>> Forge team for their work.
>>>>>>>
>>>>>>> my question is, what's the best way to generate .java,
.xhtml files
>>>>>>> with forge?
>>>>>>>
>>>>>>> Id like to write a plugin which would receive an entity class
as
>>>>>>> parameter and generate some code on top of it, eg:
>>>>>>>
>>>>>>> $ generate-service Person
>>>>>>> $ generate-controller Person
>>>>>>> $ generate-view Person
>>>>>>>
>>>>>>>
>>>>>>> Where Person is a domain object, is it possible with Forge?
if yes,
>>>>>>> whats the best way?
>>>>>>>
>>>>>>>
>>>>>>> thanks in advance.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> <
http://www.advancedit.com.br/>Att,
>>>>>>>
>>>>>>> Rafael M. Pestano
>>>>>>>
>>>>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio
Grande do
>>>>>>> Sul
>>>>>>> Graduando em Ciência da Computação UFRGS
>>>>>>> _______________________________________________
>>>>>>> forge-dev mailing list
>>>>>>> forge-dev(a)lists.jboss.org
>>>>>>>
https://lists.jboss.org/mailman/listinfo/forge-dev
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> <
http://www.advancedit.com.br/>Att,
>>>>>>
>>>>>> Rafael M. Pestano
>>>>>>
>>>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande
do
>>>>>> Sul
>>>>>> Graduando em Ciência da Computação UFRGS
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> <
http://www.advancedit.com.br/>Att,
>>>>>
>>>>> Rafael M. Pestano
>>>>>
>>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do
Sul
>>>>> Graduando em Ciência da Computação UFRGS
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> <
http://www.advancedit.com.br/>Att,
>>>>
>>>> Rafael M. Pestano
>>>>
>>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
>>>> Graduando em Ciência da Computação UFRGS
>>>> _______________________________________________
>>>> forge-dev mailing list
>>>> forge-dev(a)lists.jboss.org
>>>>
https://lists.jboss.org/mailman/listinfo/forge-dev
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> <
http://www.advancedit.com.br/>Att,
>>>
>>> Rafael M. Pestano
>>>
>>> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
>>> Graduando em Ciência da Computação UFRGS
>>>
>>> _______________________________________________
>>> forge-dev mailing list
>>> forge-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/forge-dev
>>>
>>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>>
>
>
> --
> <
http://www.advancedit.com.br/>Att,
>
> Rafael M. Pestano
>
> Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
> Graduando em Ciência da Computação UFRGS
>
> _______________________________________________
> forge-dev mailing list
> forge-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/forge-dev
>
>
--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
_______________________________________________
forge-dev mailing list
forge-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev
,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
Graduando em Ciência da Computação UFRGS