[forge-dev] Generating packages in new Java projects

Lincoln Baxter, III lincolnbaxter at gmail.com
Sat Dec 3 16:59:41 EST 2011


Well, I'd argue that Forge does use defaults somewhat already, but I agree
this could be easier. Ivan. I've been working on a new properties API that
should (in the future) be used to do exactly what Max is talking about. I
haven't quite gotten it working though. Maybe you'd like to start there
first? :)

I've created a feature branch with my changes to date so you (and Paul also
wanted to work on this,) can take a look. I'll let you fight over who wants
it. Right now the properties may be read, but it seems like there are some
issues getting writes to work properly, there is a test case for this that
shows the intent:

https://github.com/forge/core/tree/feature/FORGE-399

~Lincoln

On Sat, Dec 3, 2011 at 5:18 AM, Max Rydahl Andersen <max.andersen at redhat.com
> wrote:

>
> Hey I forgot to say I really like the intent of the fix (avoiding having
> to type in something I already told Forge once - I just don't personally
> like empty directories created :)
>
> /max
>
> On Dec 3, 2011, at 11:01, Max Rydahl Andersen 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 ? :)
> >
> > 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
> >
> >
> >
> >
> > _______________________________________________
> > forge-dev mailing list
> > forge-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/forge-dev
>
> /max
> http://about.me/maxandersen
>
>
>
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>



-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20111203/81dce555/attachment.html 


More information about the forge-dev mailing list