[forge-dev] Generating packages in new Java projects

Max Rydahl Andersen max.andersen at redhat.com
Sat Dec 3 05:01:20 EST 2011


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 ? :)

Then your initial problem goes away and you don't end up create empty directories.

/max

On Dec 2, 2011, at 15:34, Ivan St. Ivanov wrote:

> Hi folks,
> 
> I'm relatively new to Forge. However, I want to get started with it and I decided to add the smallest possible feature. So I found one candidate and I'd like to get whether it is useful and at all correct.
> 
> Right now when you create new project you have to enter top level package. And at the end you have src/main/java and src/test/java directories created for you. But you don't have your top level package directories created. And later when you try to add an entity or an ejb or any Java type, you have to first create the packages even though you have specified them already. So besides using the top level package as artifact ID in maven, I guess that Forge can as well create it automatically. Both in the sources and in the test directories. Do you think this is a useful feature or you left it out deliberately?
> 
> If you think it's fine, here is my proposal for implementing it. I spent last night debugging and hacking and I think I got how creating new projects works ;-)
> 
> So, I plan to extend the JavaSourceFacet interface with a new method: public DirectoryResource createTopLevelPackage(String topLevelPackage). In its [only] implementation (MavenJavaSourceFacet) I will use the existing machinery to create directories under the test and source maven directories and will return the created folder. Finally, in NewProjectPlugin I will call the new method with the top level package coming from the shell. I have already prepared a unit test in NewProjectPluginTest, which in the good old TDD traditions is failing epicly at the moment, as the functionality is not in place :-)
> 
> To summarize, my questions here are not about the tiny technical details, but rather on the need of such functionality and whether it is fine to extend the JavaSourceFacet interface with such operation.
> 
> Cheers,
> Ivan
> 
> BTW If you say that we need this functionality, should I create JIRA issue or an eventual pull request once you agree with my proposal will be enough?
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev

/max
http://about.me/maxandersen






More information about the forge-dev mailing list