Announcement Announcement Module
No announcement yet.
Managing components / projects / dev cycle: Maven or ant? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Managing components / projects / dev cycle: Maven or ant?

    A year ago we started working with Spring, meanwhile we managed to have clearer modules then without Spring .. so thanks for that But where are having the following problem:

    With more components (each components is an eclipse project) is seems getting harder to have a good build cycle, therefore I'm asking you some advice on how to organize your componenst / projects within i.e. eclipse. Is it for example a good idee to have a 1 on 1 mapping between a reusable component and an eclipse project .. or is that to much overhead.

    The other thing I'm finding confusing is the role of ant or maven is this picture. We definitly need a good building process and nightly builds. I take a glimb at Maven2... it seemed the thing I need together with continium. But I'm veryyy confused on the fact if we still need ant or not if we use maven? That's not clear to me.. some advice would be great

    Perhaps the pro's / con's on using ant or maven to manage your project?

    It would be great if someone could share how he is using Spring / Components / Projects / continius builds / development cycle in a large project where these components are reused by several projects.

    So... get me out of the dark here



  • #2
    At the moment I have the same problems. If have switched from ANT to maven for smaller projects (component-like projects other projects depend upon). But I`m not quite sure. I love the fact that I have total control with ANT and with Maven 1 it doesn`t feel that good (and is missing transitive dependencies) altough you have a 'perfect' buildscript for standard projects. junit testing? javadoc? clover coverage? etc.. it is all there.

    Maven 2 should be better. You could also have a look at Ivy. Maven 2 also has some ANT support for dependencies. And the next version of ANT will also have multiproject support.

    But at the moment I don`t have a solution that makes me jump from joy.


    • #3
      Personally I dislike Maven. The last time I looked at it you were required to have your project structured in a certain way. Maven offered no flexibility in project structure. Perhaps it has gotten better.

      As for the components, what we have done is each component gets a build.xml file. Which means that each component also gets a file. This is nice because it makes each component mostly standalone. For compound components there is still a build.xml, but use the ANT feature that lets you call other ant tasks from within one build file to aggrogate all the build.xmls for the base components.

      This sounds a little confusing and I don't have access to examples at the moment. Basically the best advice I can give you is to start with your base components and build your way up to a finished product. Making sure that each component can do everything by itself (this include packaging and unit testing).

      You'll probably find a bunch of commonality while you do this so treat it like any other piece of common code, refactor into a base build.xml file and use the Ant import task.

      Finally, here is an article from OnJava to get you started.


      • #4
        Loading all the Spring context / property files

        Actually, I find the 'strict' project structure more efficient then that every project has it own set of rules, but that offcoarse my 5 cent ... now back to the real question: how to develop Spring modules that can be reused!

        For example, i have the following modules and each module is an Eclipse Java project

        * Module1 (JAR)
        - java files
        - Spring context files
        - Property place holder files
        - ...

        * Module2 (WAR)
        - java files
        - web files
        - Spring context and servlet files
        - Property place holder files
        - ...

        * Application1 (depends Module1 and Module2)
        - java files
        - web files
        - Spring context and servlet files
        - Property place holder files

        * Application2 (depends Module1)
        - ...

        So what I would like is that module1 and 2 can be deployed independently on the server so taht they can be used by Application1 and 2.

        But what I don't see able to solve is that I need to defien which Spring context and property files I need to use to start up my application. The property file problem I can solve I think, but I don't see a good solution on how my Application1 knows which context files it needs to include. Yes I can document this somewhere, but It would be nicer that I just have a dependency on Module1 and that I include all its context files automatically. I have no idea how you guys manage multiple modules on a clear way zo that not every developer needs to kwon which context files he needs to include to get the application started up?

        Some input here would be great


        • #5
          Multiple WAR's

          Some extra question based upon the modules and applications in the previous post.

          What if I have multiple modules taht contain web data ... so I guess all of them need to be deployed as war's instead of jar's no? So if I put them on the server as war's and my application, which I guess needs to be also just a war, needs to use that module, is that going to work ... I never had to communicate with different war's ... can anyone shortly explain how this is done, do I need to do something like localhost:8080/app1 and then it can call something on localhost:8080/module2?



          • #6
            Deployable modules

            I'm not getting a lot of reply on how people manage multiple Spring-ified modules within a project. So I guess I'm trying to do something completely wrong because no one alse seems to have the problem?

            So for the last time I'm asking you guys out there how you handle multiple modules. Or are you making all ONE big project???

            So what I would like to know what is a good transparant way to manage and link all those ctx and properties files accross all those modules? Are managing all those modules as seperate jars wars or are you creating one big project after the build where yoy copy all your properties / ctx files from all your sub modules into 1 place? What I like to have is to hear how people manage multiple modules, deployed as seperated jars wars and reused by multiple components.

            And a little off topic I would like to hear peoples experiences with maven or ant (or both) when managing multiple project / modules in spring?



            • #7
              In terms of the reuse of modules, one approach is for each module to have an associated context config file that gets accessed via the classpath. For example, each module will have a module.xml file. The application just loads all module.xml files via a wild card. Since each module config file is unique via the module's package name, the configs are in a specific namespace.


              • #8
                So can I use the wildcard in the following circumstances:

                --> web.xml


                Or how do you see the wildcard usage because I'm not realy sure about that?



                • #9
                  I've used the wildcard approach with normal jars, using Spring's "classpath:" psuedo protocol. Not sure how's its done within web application. I imagine its similar.


                  • #10
                    rebornspirit or another... have you found some solutions for this kind of problem? I want to separete my one big application in two separete module. I want to have an architecture module and other call business module.

                    Basically, what I want is allow the business developers add an architecture jar into their module.

                    the problem is that I donīt know how to manage the differents application-context for the two modules.

                    Another problem for example are the hbm files. When I configure the session factory (I do it in the architecture module) I need and approach to help my add hbm files in the business module, because the architecture module has hbm files to.

                    thanks in advance!!