Announcement Announcement Module
Collapse
No announcement yet.
Main java and test java directories Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Main java and test java directories

    Could someone enlighten me if it is possible to change SRC_MAIN_JAVA and SRC_TEST_JAVA generated by Roo under src directory?

    Thanks
    Last edited by jtan; Sep 30th, 2009, 08:30 AM.

  • #2
    Ben or Stefan,

    Could any of you answer this please?

    Thanks.
    Last edited by jtan; Oct 1st, 2009, 08:31 AM.

    Comment


    • #3
      Roo has a project abstraction that in turn has a PathResolver abstraction designed to allow this flexibility. As such all parts of Roo that need to figure out where to read/write files will refer to the PathResolver for concrete locations.

      There is no shell command or configuration file that presently allows you to change these locations. This is because we try to follow the convention-over-configuration approach as far as possible. I have some reservations about varying away from the Maven conventions. Would you mind expanding on the reason you need this?

      If this was a major issue for your team, there is a class called org.springframework.roo.addon.maven.MavenPathResol ver which implements PathResolver. In there you'll find the initial locations that are used. Note it is @ScopeDevelopment, which the default roo-bootstrap.xml application context in the "bootstrap" project will load that class and dependency inject it in where required. Accordingly, in theory you should be able to provide your own replacement MavenPathResolver (eg MyPathResolver), annotate it with @ScopeDevelopment, and then edit roo-bootstrap.xml and add an exclude directive to the classpath scan so that MavenPathResolver is not discovered and automatically loaded by Spring. The class (eg MyPathResolver) will need to be in the Roo classpath when it starts. This in theory should allow you to use different paths.

      Comment


      • #4
        > we try to follow the convention-over-configuration approach as far as possible
        Got it.

        We have two teams, one is using Ant another is Maven. I am just happen to be the former team. That should put you into context.

        Our issue is, we have inside src, com.foo.whatever; and now Roo generates under src/main/java and src/test/java. We could not let com.foo.* inside src anymore, since Eclipse will complain it is not able to supported nested main/java and test/java under src/!

        How do we setup Eclipse so that it would not complain?

        Comment


        • #5
          My advice in that case would be to start a new Eclipse project that is built by Roo in the normal way. Because you have Ant for the rest of the project, it shouldn't be too difficult to make it include the "external" project's classpath inside its build etc. I suspect that even if you work around the Eclipse-specific problem and make Roo use custom paths, you'll likely find other things break as you have three systems competing to manage the classpath: Maven pom.xml, Ant build.xml and Eclipse. It's a relative struggle getting two of them to work together seamlessly, let alone three! :-)

          I'd certainly recommend you log an enhancement request at https://jira.springsource.org/browse/ROO for custom Maven folders. I can't promise when it will be done, but I'll have a closer look into it when reviewing some other file system directory abstraction related tasks that are presently in Jira.

          Comment

          Working...
          X