Search code examples
spring-mvcjspreusabilitytld

How to make other development teams build their own business components as jsp tags while avoiding dependencies?


I’m not sure if this is a design principle question or not but I couldn’t find a solution. I’m working in a framework team which is responsible for delivering a ui elements framework for all the other software development teams in our companny. We have a single page web application where each team can develop their own module. So after login if the user wants to search a customer she sees pages from crm application. Then let’s say she wants to check account balances of this customer then the Controllers in teller application responds. All projects are built in spring mvc and we create jsp tags like radio buttons, checkboxes with all the necessary attributes and ready to use Javascript methods in it. However, since a lot of teams join, they need to create their own tags, especially business tags which would be created by combining simple tags we offer. We have a common Java project where all tags are defined in a tld file and they (all other development teams) add this project’s jar as a maven dependency to their own web projects. By the way, each team has their own spring mvc project. For example, treasury team has their own java project which adds our common project as a dependency. So, they can use the tags we develop in their jsp files. Since there is a tld file the attributes is well defined as below:

<mycompany:photoTag id=“photoTag” photoSource=“{urlComingFromServer}” />

But what should we do if the treasury team itself needs to develop their own tag with their own business processes and services? There are some alternatives we thought but we are absolutely not sure. First, each team may have their own common project. While they are developing their own pages in their web project they may move business tags into their common project. But this will create complex dependencies like crm team depends on teller team for their tag and maybe teller will depend on another team. Another problem here is that while I am developing my project I shouldn’t be need to download all the sources related to account selector tag to my workspace if I’m using account selector tag from Teller module. How can we create an environment where each team/business module can independently create their own jsp tag which can easily be used by every other team in company?

Thank you.


Solution

  • So the concept is pretty simple, since you have maven as dependency management system. You can have your company host an artifact repository, say sonar nexus. Every developer should have this nexus instance as their release repository in their settings.xml.

    Say team A have 2 module core and common-taglib which core are their internal core code and common-taglib are for sharing with other team. They could simply publish the artifact common-taglib in nexus.

    And now team B want to use common-taglib they can simply include the taglib as dependency in pom.xml

    <dependency>
        <groupId>your.organization.teama</groupId>
        <artifactId>common-taglib</artifactId>
        <version>1.1.0</version>
    <dependency>
    

    With this, they can even have some version control in their release management. This would be an helpful blog post. It uses JFrog artifactory, but concept are the same with apache archive and sonatype nexus