Quantcast

Multi module build with multiple source sets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Multi module build with multiple source sets

mike.h.smith37
This post has NOT been accepted by the mailing list yet.
We are in the process of migrating a large legacy application to a new application platform.

We have existing gradle scripts in place for the modules, however these scripts have not, so far, supported webservice build, only compile and test. Our new application platform has some constraints, in particular @Webservice annotated classes must be singular per deployed war. Since the legacy application has many cross-module dependencies this is a problem, and I'd rather not create a multitude of tiny additional modules for each webservice.

I was looking at using SourceSets to split out the webservice annotated classes within a module and allow them to be picked out individually for the webservice build. So for example:


ModuleA
     src/
     webservice/src

ModuleB (depends upon ModuleA)
     src
     webservice/src

I'd like to be able to create a ModuleA.war that contains classes from both ModuleA/src and ModuleA/webservice/src
and a ModuleB.war that contains classes from ModuleB/src, ModuleB/webservice/src and ModuleA/src.

I've tried customizing our build scripts using SourceSets and adjustments to the new war section that was added, here's the snippet:


sourceSets{
        webservice{
                java{
                                srcDir 'webservice/src'
                }
      }
}

dependencies{
...
}

war {
    from sourceSets.webservice.output
    webInf { from 'WebContent' } // adds a file-set to the WEB-INF dir.
    exclude ( '**/*.class' )//prevents unnecessary duplication
}

Any pointers or alternative suggestions much appreciated.

Thanks.




Loading...