简体   繁体   中英

Multiple war files from same base code, Gradle

I have a situation wherein i have multiple war files with 90% code base same (controllers, html files etc). They have some custom code for each along with different configurations.

Currently these projects are nothing but a copy of each others (with minor tweaks and config changes).

How should i approach this for creating a single module/jar from where these multiple wars can be created with minim code(their respective changes) in the war modules.

So, the common module will have all the code along with the html files and in each war module i'll just override/provide different implementation.

I am using Gradle for build. Using Java, Spring.

Say, I have a Project FOO. It's a web project with java classes, html, properties and configuration (beans, persistence) files and web.xml file.

I have another project BOO. which is a copy of FOO but there are some property changes, some code changes to existing implementation and some new code of it's own.

I dont want to keep duplicate code in BOO, BOO should ideally have the new code and the changed implementation.

This is what i want to achieve.

I cant post the code as its a big project.

Hope this makes it clear.

This is perfectly a refactoring project. Your main concentration area are all config files and default servlet and default html pages. As your project codes are not available here we can not directly advice you any more. You have to carefully check configuration of each project and find a solution how you can club together all the config files. Especially concentrate in spring-bean.xml and web.xml. You must be very careful else it will take ages for you to merge all the application. Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM