[forge-dev] Generating packages in new Java projects

Ivan St. Ivanov ivan.st.ivanov at gmail.com
Sun Dec 4 02:49:07 EST 2011


Hi there! :-)

Thanks to all of you for the feedback! I'll first look at what Lincoln
proposed (the new properties API).

*@Dan*: I tried using the getBasePackage method, but it appears that it
returns the base package of the plugin from which it is called. That is, it
returned me something like org.jboss.forge.shell and not com.test (or
whatever I passed on the command line).

*@Paul*: After I got more into the API, I agree with you. Most of the
methods in the Facet interfaces are rather "passive" - they contain
contextual information used later by the plugins. At least this is how I
got it. So you are right, the facet seems not to be the correct place for
this implementation.

Cheers!
Ivan

On Sun, Dec 4, 2011 at 1:22 AM, Paul Bakker <paul.bakker.nl at gmail.com>wrote:

> I agree that it's not necessarily bad to create empty directories in this
> case, because than it's also available in the IDE. And because it's the
> base package it makes sense to put code there too, I don't think it is a
> broken window in this specific case.
>
> I don't think it's necessary to add a new method to the JavaSourceFacet.
> It's something that only the NewProjectPlugin will use, while the
> JavaSourceFacet is very general (many plugins use this facet). Just create
> the directory in the NewProjectPlugin itself. Prompting the user for this
> first would be a good idea too :-)
>
> Paul
>
>
>
> On Dec 4, 2011, at 12:11 AM, Dan Allen wrote:
>
> On Sat, Dec 3, 2011 at 05:01, Max Rydahl Andersen <max.andersen at redhat.com
> > wrote:
>
>> So you are saying if I type in x.y.z as package name you will create the
>> empty sequence of directories:
>>
>> <src>/x/y/z ?
>>
>> If that is the case then I don't see the need for it before there
>> actually is a file to put in there…?
>>
>> Empty directories is a broken window.
>>
>> What would be more fun is that forge would actually remember the last
>> package name used for a command so
>> it would offer it as default (Lincoln - did you get that
>> properties/config stuff in place ? :)
>>
>
> There is a mechanism for this. I'm using it in the Arquillian Extensions
> plugin.
>
> JavaSourceFacet#getBasePackage()
>
> That's the one that was entered at the prompt...at least it appears that
> way.
>
> I don't think that creating the directories is necessarily wrong. If they
> open the project in the IDE immediately after creating it, then the first
> time they create a class it's necessary to retype the package name. It's
> far easier to right click on an existing package structure and create a new
> class.
>
> Perhaps the user can be prompted for this option (or it can be an optional
> option).
>
> new-project --named myproject --topLevelPackage org.example.myproject
> --createPackages
>
> -Dan
>
> --
> Dan Allen
> Principal Software Engineer, Red Hat | Author of Seam in Action
> Registered Linux User #231597
>
> http://www.google.com/profiles/dan.j.allen#about
> http://mojavelinux.com
> http://mojavelinux.com/seaminaction
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20111204/fc783382/attachment-0001.html 


More information about the forge-dev mailing list