[forge-dev] Generating packages in new Java projects

Ivan St. Ivanov ivan.st.ivanov at gmail.com
Fri Dec 2 09:34:27 EST 2011


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20111202/83d1d695/attachment.html 


More information about the forge-dev mailing list