<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jeff A Schenk on Medium]]></title>
        <description><![CDATA[Stories by Jeff A Schenk on Medium]]></description>
        <link>https://medium.com/@JeffASchenk?source=rss-2bf5213d965f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*msQ8EQxrzX-T0tb1D4YpZA.jpeg</url>
            <title>Stories by Jeff A Schenk on Medium</title>
            <link>https://medium.com/@JeffASchenk?source=rss-2bf5213d965f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:27:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@JeffASchenk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your Domain’s Spring Boot Parent POM]]></title>
            <link>https://medium.com/@JeffASchenk/your-domains-spring-boot-parent-pom-3287f991e621?source=rss-2bf5213d965f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3287f991e621</guid>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[parent-pom]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Jeff A Schenk]]></dc:creator>
            <pubDate>Sun, 23 Jan 2022 04:44:16 GMT</pubDate>
            <atom:updated>2022-01-23T04:44:16.349Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*hZpmuSEy_yOENTQ4TiXTfA.png" /></figure><p>Establishing Domain Standards can be a difficult and having the developers keep to those standards can be even more daunting. <em>What if we could establish many of our build practices and dependency usage standards easily so every developer on the team can use and follow without much effort?</em></p><p>As every Java Spring Developer has at least once created a Spring Boot project using the Spring Initializr located at <a href="https://start.spring.io/">https://start.spring.io/.</a> Below we have an example of the generated project pom.xml from the starter tool.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2bc288df3660d81534fa5b0c830c8134/href">https://medium.com/media/2bc288df3660d81534fa5b0c830c8134/href</a></iframe><p>We notice our Parent POM is the Spring Boot Starter Parent, perfect.</p><p><strong><em>But what if we would like to ensure standards are being used within our shop’s domain?</em></strong> We certainly do not want to have every distinct project POM to have duplicated dependencies, plugin-ins, packaging, CI/CD, default property settings as such.</p><p>Using Maven’s <em>inheritance</em> model, we can easily build our own domain Parent POM to ensure our defined standards, whose <em>parent</em> is the Spring Boot Starter parent. This will make upgrading to next subsequent version of the Spring Boot stack easy and concise. Having your ‘Domain Parent POM’ ‘<em>deployed</em>’ in your domain’s Maven Repository of choice and in source control with branch specific to a ‘deployed’ version, you will be able to take advantage of ensuring your defined standards are met and used by every developer. Also, having the stack flexibility of upgrading as well as downgrading if necessary, by simple changing the domain Parent POM version. This will also help the Junior and new developers to your environment get up to speed quickly.</p><p><strong><em>Lets look at the details to construct a ‘domain’ parent POM.</em></strong> To begin lets open your favorite editor or IDE and create our ‘domain parent’ pom.xml using the following section to initialize it: <em>(Please see Github references below for actual source code to fork.)</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb9c7415228537fef30762295949bf86/href">https://medium.com/media/bb9c7415228537fef30762295949bf86/href</a></iframe><p>We begin by editing the standard pom information and the project’s <em>group Id, artifact Id, version and packaging</em>, which is this case will be ‘<strong><em>pom</em></strong>’.</p><p>And we specify that our parent is the <strong><em>spring-boot-starter-parent</em></strong> pom.</p><p>We are essentially injecting our standards into place and taking advantage of the Spring Boot parent as well.</p><p><strong>Next we establish our default properties.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db3c457d616de2d922d5b71756a121ab/href">https://medium.com/media/db3c457d616de2d922d5b71756a121ab/href</a></iframe><p>Here we establish any default properties, such as, version of various dependencies we will be including in our stack.</p><p>We also establish our project’s default encoding of UTF-8. And establish the default version of Java which we should be using.</p><p>We establish core dependency version properties for various artifact component standard on our stack.</p><p><em>These are examples and yours would be based upon your shop’s domain stack specifications.</em></p><p><strong>Next we start adding in our dependencies.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d4503ef5af4d6e4a816d8cc70423cd2/href">https://medium.com/media/1d4503ef5af4d6e4a816d8cc70423cd2/href</a></iframe><p><em>Establish the ‘spring-boot-starter’ and excluding logging from that artifact.</em></p><p><em>Here we establish our LOG4J2 starter and excluding certain artifacts.</em></p><p><em>Adding the Core Log4J logging and SLF4J simple implementation.</em></p><p><em>Adding Actuator to the stack and control the logging by removing default.</em></p><p><em>Adding Spring Framework retry support.</em></p><p><em>Adding Spring Framework Aspect and previously defined AOP support.</em></p><p><em>Adding the Cloud Configuration client support.</em></p><p><em>Adding Consul Discovery support.</em></p><p><em>Adding Micrometer support.</em></p><p><em>Adding your Monitoring agent, registry or push gateway client.</em></p><p><em>Adding Lombok for our data models.</em></p><p><em>Establish Test dependencies.</em></p><p><em>Adding Tracing capability such as ‘sleuth’.</em></p><p><em>Add a Dependency Management section for the Spring Cloud stack.</em></p><p><strong>Next we define our ‘build’ section with our default plug-ins.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1aa9b6b8ab65f46dcd1c61b7354befc6/href">https://medium.com/media/1aa9b6b8ab65f46dcd1c61b7354befc6/href</a></iframe><p><em>Establish standard resources which we want within our built artifact.</em></p><p><em>As with the LOG4J vulnerability, we add the Maven enforcer plugin to ensure we have a LOG4J2 stack version of 2.17.1 or greater.</em></p><p><em>Establish our deployment plug-in.</em></p><p><em>Establish Check Style plug-in.</em></p><p><em>Establish the OSWASP dependency checker. To verify no vulnerabilities exist against a specific database.</em></p><p><em>Establish standard formatting of your source code prior to check-ins.</em></p><p><em>Establish the Compiler.</em></p><p><em>Establish the Surefire Test Suite.</em></p><p><em>Establish and configure the Maven Spring Boot Packaging plug-in.</em></p><p><em>Add Build information properties, which will appear within ‘actuator’ endpoint.</em></p><p><em>Establish any additional plug-ins which are required at the base project level for all projects to inherit.</em></p><p><em>Add any Distribution Management specifications as application per your shop’s domain standards.</em></p><p>Now that we have our Parent POM, lets verify our dependency chain by entering the following Maven command:</p><pre>$ mvn dependency:tree</pre><p>A sample dependency tree output, <em>after possible numerous downloads from Maven central or your established Domain Maven repository</em>, would be:</p><pre>Scanning for projects...<br> <br> ------------------&lt; io.yourdomain:springboot-parent &gt;--------------<br> Building springboot-parent 0.0.1<br> --------------------------------[ pom ]----------------------------<br> <br> --- maven-dependency-plugin:3.2.0:tree (default-cli) @ springboot-parent ---<br> io.yourdomain:springboot-parent:pom:0.0.1<br> +- org.springframework.boot:spring-boot-starter:jar:2.6.3:compile<br> |  +- org.springframework.boot:spring-boot:jar:2.6.3:compile<br> |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.3:compile<br> |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.3:compile</pre><pre>...</pre><p>This output should be reviewed to ensure you have established the correct base dependencies for your projects at these version levels.</p><p>Now that we have verified our dependencies are correct, let’s locally install the POM, by using the following Maven command:</p><pre>$ mvn clean install</pre><p>The above command will ‘<em>install</em>’ the parent POM to your local Maven repository, whose default is normally located at <em>~/.m2/repository</em> .</p><p>Now we can reference this Parent POM in our local maven project builds.</p><p>To establish your Parent POM in your domain’s Maven repository or choice, you would use the following command performed by a service agent which has necessary access to to perform the following Maven command:</p><pre>$ mvn clean deploy</pre><p>Okay, we are now all set to start using our new Parent POM. Let’s create a new simple demo project using the Spring starter Tool. <em>(See Github references below for a Usage example project source.)</em> After generating and having extracted the generated source code locally, let’s edit the project POM using the following example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11fac3a805334165eddedf26e07383dd/href">https://medium.com/media/11fac3a805334165eddedf26e07383dd/href</a></iframe><p><em>Specify our domain’s parent POM, that we have just established.</em></p><p>Specify the standard project and artifact information.</p><p><em>Override any properties established at our Parent POM or the Spring Boot Parent starter POM. Here we override our Java version, using Java 17 LTS.</em></p><p><em>Minimal ‘build’ section, as we have everything we need in our Parent POM. </em>Joy!</p><p><em>We can always add additional plug-ins if necessary to inject into the ‘build’ at the project level if necessary.</em></p><p><em>Minimal ‘dependency’ section per project usage.</em></p><p>Now build the project using the following Maven command:</p><pre>$ mvn clean verify | tee build.log</pre><p><em>The example abridged project ‘build’ output would look something like this:</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad2c54422a3e332432dbd5869ad29398/href">https://medium.com/media/ad2c54422a3e332432dbd5869ad29398/href</a></iframe><p>All our standard plug-ins were established and run accordingly and the as well as the dependency chain for the established domain’s Parent POM.</p><p>I hope this provides some useful information for Java, Maven and Spring Boot domain shops.</p><p>In a future installment, I will discuss the use of ‘Stack’ POMs to further extend standards for various usage stacks. Such as specific ‘Stack’ POMs perhaps for ‘Kafka’, ‘Couchbase’, ‘Oracle’, ‘Web’, ‘Reactive’ and so on. These will compliment your Domain Parent POM and establish the necessary version and dependency standards for your stack dependencies.</p><p><em>Possibilities are of course endless, all depends on your domain’s standards, usage patterns and even some CI/CD as this methodology provides a good way to establish and live by required standards. Remember, in your code review, ‘Where is our Parent POM?’</em></p><h3>References</h3><p>Source code Github link to Your-SB-Parent-POM-Usage locate at: <a href="https://github.com/jaschenk/Your-SB-Parent-POM-Usage">https://github.com/jaschenk/Your-SB-Parent-POM-Usage</a></p><p>Source code Github link to Your-SB-Parent-POM located at: <a href="https://github.com/jaschenk/Your-SB-Parent-POM-Usage">https://github.com/jaschenk/Your-SB-Parent-POM-Usage</a></p><p>Apache Maven Project: <a href="https://maven.apache.org/pom.html">https://maven.apache.org/pom.html</a></p><p>Spring Initialzr Tool: <a href="https://start.spring.io/">https://start.spring.io/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3287f991e621" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>