<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sameer</title>
    <description>The latest articles on DEV Community by Sameer (@cricketsamya).</description>
    <link>https://dev.to/cricketsamya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F733161%2F48fa3a9f-ddb0-42d4-a2b8-eb5df4b13997.png</url>
      <title>DEV Community: Sameer</title>
      <link>https://dev.to/cricketsamya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cricketsamya"/>
    <language>en</language>
    <item>
      <title>Java and Typescript</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Wed, 12 Apr 2023 12:43:52 +0000</pubDate>
      <link>https://dev.to/cricketsamya/java-and-typescript-4pdh</link>
      <guid>https://dev.to/cricketsamya/java-and-typescript-4pdh</guid>
      <description>&lt;h2&gt;
  
  
  Java and Typescript
&lt;/h2&gt;

&lt;p&gt;Java and TypeScript are two popular programming languages that have their own unique strengths and weaknesses. In this blog post, I will compare the two languages and highlight the key differences between them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Java is a mature, object-oriented language that has been around for over two decades. It is a popular language for building enterprise-level applications and is widely used in web development, Android app development, and server-side programming.&lt;/p&gt;

&lt;p&gt;TypeScript, on the other hand, is a relatively new language that was introduced by Microsoft. It is a superset of JavaScript and adds additional features such as static typing, classes, and interfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;

&lt;p&gt;One of the key differences between Java and TypeScript is their syntax. Java has a more verbose syntax that requires the use of curly braces, semicolons, and parentheses. TypeScript, on the other hand, has a more concise syntax that is similar to JavaScript.&lt;/p&gt;

&lt;p&gt;For example, here is a simple "Hello, world!" program in Java:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HelloWorld&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, world!"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here is the same program in TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, world!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Type Checking
&lt;/h2&gt;

&lt;p&gt;One of the main advantages of TypeScript over Java is its support for static typing. Static typing allows developers to catch errors at compile time rather than at runtime, which can save a lot of time and effort.&lt;/p&gt;

&lt;p&gt;Java also supports static typing, but it is more verbose and requires more code. TypeScript, on the other hand, allows developers to use type annotations to specify the types of variables, parameters, and return values.&lt;/p&gt;

&lt;p&gt;For example, here is a simple function in Java that adds two numbers together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here is the same function in TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, the TypeScript code is more concise and easier to read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tooling
&lt;/h2&gt;

&lt;p&gt;Both Java and TypeScript have a wide range of tools and libraries available to developers. However, Java has been around for much longer and has a more mature ecosystem. There are a wide range of IDEs, build tools, and libraries available for Java, and many large companies use Java as their primary programming language.&lt;/p&gt;

&lt;p&gt;TypeScript, on the other hand, is a newer language and has a smaller ecosystem. However, Microsoft has invested heavily in the language and has developed a wide range of tools and libraries to support it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, Java and TypeScript are two popular programming languages that have their own unique strengths and weaknesses. Java is a mature language that is widely used in enterprise-level applications, while TypeScript is a newer language that adds additional features to JavaScript.&lt;/p&gt;

&lt;p&gt;Both languages have their own syntax, type checking, and tooling, and developers should choose the language that best fits their needs. If you are looking for a language with a mature ecosystem and wide range of tools, Java may be the best choice. If you are looking for a language with a concise syntax and support for static typing, TypeScript may be the best choice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Java
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A mature object-oriented language&lt;/li&gt;
&lt;li&gt;Requires verbose syntax with curly braces, semicolons, and parentheses&lt;/li&gt;
&lt;li&gt;Supports static typing with more verbose code&lt;/li&gt;
&lt;li&gt;Has a wide range of IDEs, build tools, and libraries available&lt;/li&gt;
&lt;li&gt;Widely used in enterprise-level applications, web development, Android app development, and server-side programming&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  TypeScript
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A relatively new language&lt;/li&gt;
&lt;li&gt;A superset of JavaScript with a concise syntax&lt;/li&gt;
&lt;li&gt;Adds additional features such as static typing, classes, and interfaces&lt;/li&gt;
&lt;li&gt;Supports static typing with type annotations for variables, parameters, and return values&lt;/li&gt;
&lt;li&gt;Has a smaller ecosystem but has a wide range of tools and libraries&lt;/li&gt;
&lt;li&gt;Popular for web development, especially for front-end frameworks like Angular&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org"&gt;Typescript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/microsoft/TypeScript"&gt;Typescript Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>java</category>
      <category>backend</category>
    </item>
    <item>
      <title>Whats the best way to branch code repo?</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Mon, 23 Jan 2023 08:38:44 +0000</pubDate>
      <link>https://dev.to/cricketsamya/whats-the-best-way-branching-code-repo-46ak</link>
      <guid>https://dev.to/cricketsamya/whats-the-best-way-branching-code-repo-46ak</guid>
      <description>&lt;p&gt;Currently, we are in a process of restructuring our branching. The main requirement is that, features should be tested in isolation and can be released one by one. &lt;/p&gt;

&lt;p&gt;We have 2 branches, develop and main, and 3 deployment environments. DEV, STAGE and PROD. &lt;/p&gt;

&lt;p&gt;We do feature branches out of DEV and do peer QA on these branches. Once the code is merged to develop we do a QA on the features merged on DEV env. And then to STAGE and to PROD.&lt;/p&gt;

&lt;p&gt;But for us its really hard to release the features one by one. For now we are planning to block merge to develop until we merge the develop to main.&lt;/p&gt;

&lt;p&gt;Any better strategy we can follow?&lt;/p&gt;

</description>
      <category>solidjs</category>
      <category>vue</category>
      <category>svelte</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Log4j to Logback migration? Good idea or not?
</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Tue, 25 Jan 2022 12:36:09 +0000</pubDate>
      <link>https://dev.to/cricketsamya/log4j-to-logback-migration-good-idea-or-not-1hc5</link>
      <guid>https://dev.to/cricketsamya/log4j-to-logback-migration-good-idea-or-not-1hc5</guid>
      <description>&lt;h2&gt;
  
  
  New Buzz word Log4j
&lt;/h2&gt;

&lt;p&gt;By end of 2021, there came a new buzz word "LOG4J". People who don't know what log4j is started to talk about it. Jokes a part, log4j teared the world apart because of the security vulnerability  that were exploited by Hackers. This security vulnerability was allowing attackers to execute malicious code remotely on a target computer. Which means hackers can easily steal data, plant malware, or take control of the target computer via the Internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to overcome this issue
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Solution 1
&lt;/h3&gt;

&lt;p&gt;Update the library usage to the latest released version of log4j, where Apache team has fixed the "known" vulnerabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution 2
&lt;/h3&gt;

&lt;p&gt;Switch to different logger e.g. Logback &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Logback?
&lt;/h2&gt;

&lt;p&gt;Logback is a logging framework for mostly Java based applications, and a successor to the popular log4j project. Logback has many improvements over log4j. Just for information, logback is very much like log4j as both the projects were founded by the same developers. Logback is very similar to log4j when it comes to usage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Logback?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Its very much like log4j, no extra knowledge need to use.&lt;/li&gt;
&lt;li&gt;As its very much similar to log4j, its easy to replace.&lt;/li&gt;
&lt;li&gt;Logback uses slf4j &lt;a href="https://logback.qos.ch/reasonsToSwitch.html"&gt;natively&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Auto compression of log files.&lt;/li&gt;
&lt;li&gt;Many more.. Have a look at: &lt;a href="https://logback.qos.ch/reasonsToSwitch.html"&gt;Reasons to switch&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to use Logback?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add the logback dependencies. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;slf4j-api&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;${slf4j-version}&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;

&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;ch.qos.logback&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;logback-core&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;${logback-version}&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;

&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;ch.qos.logback&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;logback-classic&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;${logback-version}&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Gradle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;implementation("org.slf4j:slf4j-api:${slf4j-version}")
implementation("ch.qos.logback:logback-core:${logback-version}")
implementation("ch.qos.logback:logback-classic:${logback-version}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If JAR files are needed locally then download them from logback &lt;a href="https://logback.qos.ch/download.html"&gt;download&lt;/a&gt; page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;If the application is based on Spring boot then, no additional dependencies are required as Spring boot provides log back support.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Add &lt;code&gt;logback.xml&lt;/code&gt; file (logback-spring.xml in case of Spring boot) in &lt;code&gt;src\main\resources&lt;/code&gt;. 
Sample &lt;code&gt;logback.xml&lt;/code&gt; For more information about Logback configuration, check &lt;a href="https://logback.qos.ch/manual/configuration.html"&gt;Link&lt;/a&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;configuration&amp;gt;

    &amp;lt;appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"&amp;gt;
        &amp;lt;layout class="ch.qos.logback.classic.PatternLayout"&amp;gt;
            &amp;lt;Pattern&amp;gt;
                %date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC} - %yellow([tid:%t])[sid:%X{httpSessionId}][reqid:%X{reqId}] - %green(%level) %cyan([%c]) - %m%n
            &amp;lt;/Pattern&amp;gt;
        &amp;lt;/layout&amp;gt;
    &amp;lt;/appender&amp;gt;

    &amp;lt;appender name="appServerRollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender"&amp;gt;
        &amp;lt;file&amp;gt;applogs/shpi-api.log&amp;lt;/file&amp;gt;
        &amp;lt;rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"&amp;gt;
            &amp;lt;fileNamePattern&amp;gt;applogs/$${date:yyyy-MMM}/shpi-api-%d{yyyy-MMM-dd}-%i.log.gz&amp;lt;/fileNamePattern&amp;gt;
        &amp;lt;/rollingPolicy&amp;gt;

        &amp;lt;triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"&amp;gt;
            &amp;lt;maxFileSize&amp;gt;200MB&amp;lt;/maxFileSize&amp;gt;
        &amp;lt;/triggeringPolicy&amp;gt;
        &amp;lt;encoder&amp;gt;
            &amp;lt;pattern&amp;gt;%date{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX", UTC} - [sid:%X{httpSessionId}][actor:%X{userId}][reqid:%X{reqId}] - %p [%c] - %m%n&amp;lt;/pattern&amp;gt;
        &amp;lt;/encoder&amp;gt;
    &amp;lt;/appender&amp;gt;

    &amp;lt;root level="info"&amp;gt;
        &amp;lt;appender-ref ref="STDOUT"/&amp;gt;
        &amp;lt;appender-ref ref="appServerRollingFile"/&amp;gt;
    &amp;lt;/root&amp;gt;

&amp;lt;/configuration&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
How to use LoggerFactory instance.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.slf4j.Logger&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.slf4j.LoggerFactory&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;Logger&lt;/span&gt; &lt;span class="no"&gt;LOG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LoggerFactory&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getLogger&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ClassName&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="no"&gt;LOG&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;warn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Warn Test"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;-&lt;br&gt;
If migrating from Log4j to Logback use this translator tool from logback developers &lt;a href="https://logback.qos.ch/translator/"&gt;Translator&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Idea behind use of logback is the recent issues with log4j which gave everyone a reality check, that now there is definite need of log4j alternative.&lt;br&gt;
May be now is the time to migrate!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.baeldung.com/spring-boot-logging"&gt;Spring boot and Logback&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://logback.qos.ch/"&gt;Logback Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://logging.apache.org/log4j/2.x/"&gt;Apache Log4j&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>logging</category>
      <category>log4j</category>
      <category>java</category>
      <category>springboot</category>
    </item>
    <item>
      <title>Stable CI/CD is not a Myth, From Nexus-Jenkins to Github Packages-Actions</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Tue, 18 Jan 2022 12:43:49 +0000</pubDate>
      <link>https://dev.to/cricketsamya/stable-cicd-is-not-a-myth-from-nexus-jenkins-to-github-packages-actions-4o4o</link>
      <guid>https://dev.to/cricketsamya/stable-cicd-is-not-a-myth-from-nexus-jenkins-to-github-packages-actions-4o4o</guid>
      <description>&lt;p&gt;This article provides an overview and learnings about why migration from own hosted CI/CD to SaaS CI/CD, is a way to go!&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's first understand the history
&lt;/h2&gt;

&lt;p&gt;Software Engineers from Generation X, Millennials generation must have at least once in their life worked with Jenkins (Back in time was Hudson). Java Stack CI/CD evolved around Jenkins. Most of us atleast once used Jenkins. And  Artifactory later Nexus perfectly complements each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  How our Self-hosted Jenkins and Nexus setup could look like.
&lt;/h2&gt;

&lt;p&gt;Jenkins is mostly used for CI/CD, and in some cases as a Batch processor. To satisfy this requirement self hosted Jenkins instances running over AWS or self hosted pods on Kubernetes(K8S), mainly in MASTER -&amp;gt; SLAVE (agents) configuration is a correct choice.&lt;/p&gt;

&lt;p&gt;Nexus instance can also be self hosted over AWS or with K8S.&lt;/p&gt;

&lt;p&gt;Some of many problems with this setup and some solutions to fix some of them. &lt;/p&gt;

&lt;h3&gt;
  
  
  Problem 1. Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Solution 1: 1st approach to make it secure is to use, &lt;strong&gt;VPN&lt;/strong&gt;. Of course that makes it secure on the cost of performance plus overhead maintaining VPN instance as well.&lt;/li&gt;
&lt;li&gt;Solution 2: To over come Open VPN issues, Client Side Certificates can be used. This setup involved writing a small code that will create a certificate and pushing the information to the certificate repo. But maintaining the certificate is kind of painful task.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problem 2. Random Jenkins restarts, auto updates
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Solution:  Disabling auto update feature.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problem 3. Outdated Plugins
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Solution: Jenkins community is not growing these days, as other communities so some the plugins are not maintained and they dont work with new versions of Jenkins. So sticking to outdated plugins makes sense.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problem 4. Pipeline builds
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Again maintenance and writing &lt;code&gt;Jenkinsfile&lt;/code&gt; without much of documentation is kind of hard.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problem 5. Nexus maintenance is nightmare
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;DevOps team has to be own their toes , to patch and fix the Nexus instance, as storage could often be a issue. So storage has to be maintained manually. Plus deletion of old artifacts is also one more problem to tackle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Last but not the least, Jenkins will fail when its needed the most. As most of the teams would rely on Jenkins for CI/CD these problems can grow exponentially and the maintenance causing DevOps precious time. &lt;/p&gt;

&lt;p&gt;To make everyone's life easier moving to &lt;strong&gt;GitHub Actions and GitHub Packages&lt;/strong&gt; could be a solution!&lt;/p&gt;

&lt;h2&gt;
  
  
  How CI/CD with GitHub Action could look like.
&lt;/h2&gt;

&lt;p&gt;The advantage of migrating to GitHub Action is to use &lt;strong&gt;YAML&lt;/strong&gt; instead of different way of defining the Job with Jenkins. Those YAML files are maintained under &lt;code&gt;.github&lt;/code&gt; folder under the respective project that gives the ownership of the flows to the Project/Module owner. Below are some sample workflows that can be defined.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;Build Develop/Main&lt;/code&gt; - For manually building &lt;code&gt;develop&lt;/code&gt; or &lt;code&gt;main&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Build PR&lt;/code&gt; - When ever a PR is raised for a merge on &lt;code&gt;develop&lt;/code&gt; or &lt;code&gt;main&lt;/code&gt; then this workflow is executed. This is runs whenever there is commit on the branch.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Publish&lt;/code&gt; - After successful build of &lt;code&gt;develop&lt;/code&gt; or &lt;code&gt;main&lt;/code&gt;, built jar is pushed to GitHub Packages.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Release Manual&lt;/code&gt; - Manually releasing &amp;amp; tagging a fixed version.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Auto Deploy API to DEV&lt;/code&gt; - After successful built of &lt;code&gt;develop&lt;/code&gt; or &lt;code&gt;main&lt;/code&gt;, changes are deployed to DEVELOPMENT environment.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Deploy API to ENV&lt;/code&gt; - Manual Deployment of fixed version of API to different environments.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Some Learnings after migration to GitHub Actions and Packages.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stable CI /CD is not a Myth!&lt;/li&gt;
&lt;li&gt;Now the project CI/CD is maintained by respective team, instead DevOps team.&lt;/li&gt;
&lt;li&gt;Saved a lot of developer time, troubleshoot the issues with Jenkins and Nexus.&lt;/li&gt;
&lt;li&gt;Saved resources as GitHub instance is used instead of self hosted.&lt;/li&gt;
&lt;li&gt;Cost effective, as most basic subscription of GitHub provides access to Actions and Packages.&lt;/li&gt;
&lt;li&gt;Stable and efficient as compared to Jenkins and Nexus.&lt;/li&gt;
&lt;li&gt;Large Marketplace.&lt;/li&gt;
&lt;li&gt;Large Developer community, more and more free actions (e.g - &lt;a href="https://github.com/rtCamp/action-slack-notify"&gt;Slack Notification&lt;/a&gt; etc.) available.&lt;/li&gt;
&lt;li&gt;Very short migration time. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Migration to GitHub Actions and Packages could save lot of frustration with Jenkins-Nexus combo. This will give you a chance to try out latest tools rather than being with old and outdated technologies. The process is may not be ideal for everyone, but it solves most of the issues with Jenkins. &lt;/p&gt;

&lt;p&gt;As I said earlier, Stable CI/CD is not a Myth!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/learn-github-actions/migrating-from-jenkins-to-github-actions"&gt;Migrating from Jenkins to GitHub Actions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/learn-github-actions/introduction-to-github-actions"&gt;Introduction to GitHub Actions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.bitsrc.io/github-actions-or-jenkins-making-the-right-choice-for-you-9ac774684c8"&gt;Github Actions or Jenkins? Making the Right Choice for You&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/rtCamp/action-slack-notify"&gt;Slack Notification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/marketplace?type=actions"&gt;GitHub Marketplace&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.pexels.com/photo/aerial-photo-of-buildings-and-roads-681335/"&gt;Photo by Aleksejs Bergmanis from Pexels&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
      <category>devops</category>
      <category>java</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>To do a Code task or not! </title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Tue, 11 Jan 2022 08:45:19 +0000</pubDate>
      <link>https://dev.to/cricketsamya/to-do-a-code-task-or-not-4767</link>
      <guid>https://dev.to/cricketsamya/to-do-a-code-task-or-not-4767</guid>
      <description>&lt;p&gt;I as a Senior Software Engineer, when think of applying for a job, few things come to my min.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What if as a Senior I don't fullfil the expectation?&lt;/li&gt;
&lt;li&gt;What if I was presented a Live Coding Challenge? &lt;/li&gt;
&lt;li&gt;What if I was given a Coding Task?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So after some thinking, I realised it all comes to judge me based on my coding skills. &lt;/p&gt;

&lt;p&gt;When you work on a real challenge you use StackOverflow, Google etc etc. (Copy &amp;amp; Paste works in most cases, except some complex business logic)&lt;/p&gt;

&lt;p&gt;But as you code for an interview offline or online, you think about Copy &amp;amp; Paste method. In live coding you can't even do that. For offline coding you can get inspired from some logic you find online.&lt;/p&gt;

&lt;p&gt;My question is, what should be the ideal approach to these problems during job interviews?&lt;/p&gt;

&lt;p&gt;Should coding is good metric to judge someone? Live coding makes sense? Or Git repos with some code exploring should be a metric.&lt;/p&gt;

&lt;p&gt;Share your thoughts, experiences, Lets learn together. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>hiring</category>
      <category>github</category>
    </item>
    <item>
      <title>Discuss : What is A Code Review? (PR)</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Mon, 20 Dec 2021 15:29:36 +0000</pubDate>
      <link>https://dev.to/cricketsamya/discuss-what-is-a-code-review-pr-3g0m</link>
      <guid>https://dev.to/cricketsamya/discuss-what-is-a-code-review-pr-3g0m</guid>
      <description>&lt;p&gt;Since so many days a Topic is in my mind. I would like to know, what is a code review for you? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Syntax and code quality check&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Business logic check&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Both&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How much important is each topic? &lt;/p&gt;

&lt;p&gt;How a usual code review looks like for you?&lt;/p&gt;

&lt;p&gt;Please share your views and thoughts!&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>codequality</category>
      <category>discuss</category>
      <category>github</category>
    </item>
    <item>
      <title>Testcontainers with Spring Boot and Java 11/17</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Wed, 08 Dec 2021 17:54:50 +0000</pubDate>
      <link>https://dev.to/cricketsamya/testcontainers-with-spring-boot-and-java-1117-gk0</link>
      <guid>https://dev.to/cricketsamya/testcontainers-with-spring-boot-and-java-1117-gk0</guid>
      <description>&lt;h2&gt;
  
  
  What are Testcontainers?
&lt;/h2&gt;

&lt;p&gt;Testcontainers is a JVM library that allows users to run and manage Docker images and control them from Java code.&lt;br&gt;
The integration test additionally runs external components as real Docker containers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Databases&lt;/strong&gt; - Run PostgreSQL as a Docker image&lt;br&gt;
&lt;strong&gt;Mocked HTTP server&lt;/strong&gt; - HTTP services by using MockServer or WireMock Docker images&lt;br&gt;
&lt;strong&gt;Redis&lt;/strong&gt; - run real Redis as a Docker image,&lt;br&gt;
&lt;strong&gt;Message Brokers&lt;/strong&gt; - RabbitMQ&lt;br&gt;
&lt;strong&gt;AWS -&lt;/strong&gt; S3, DynamoDB etc&lt;br&gt;
Any other &lt;strong&gt;application&lt;/strong&gt; that can be run as a Docker image&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Setup : Spring Boot and Junit 5&lt;/li&gt;
&lt;li&gt;Dependency to testImplementation "org.testcontainers:postgresql:1.16.2” and testImplementation "org.testcontainers:junit-jupiter:1.16.2”&lt;/li&gt;
&lt;li&gt;And then some wireing () to start testcontainers and link them to the test context so that integration tests knows where to look for the containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example Abstract Class for setup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;package&lt;/span&gt; &lt;span class="nn"&gt;com.test&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.boot.test.context.SpringBootTest&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.ApplicationContextInitializer&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.ConfigurableApplicationContext&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.context.annotation.PropertySource&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.test.context.ActiveProfiles&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.test.context.ContextConfiguration&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.test.context.support.TestPropertySourceUtils&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.testcontainers.containers.PostgreSQLContainer&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.testcontainers.ext.ScriptUtils&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.testcontainers.jdbc.JdbcDatabaseDelegate&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.testcontainers.junit.jupiter.Testcontainers&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.testcontainers.shaded.com.fasterxml.jackson.databind.SerializationFeature&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.Optional&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;static&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;springframework&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;web&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;servlet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MockMvcRequestBuilders&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;post&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;static&lt;/span&gt; &lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;springframework&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;web&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;servlet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MockMvcRequestBuilders&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;


&lt;span class="nd"&gt;@Testcontainers&lt;/span&gt;
&lt;span class="nd"&gt;@SpringBootTest&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;webEnvironment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SpringBootTest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;WebEnvironment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;RANDOM_PORT&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;classes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Application&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
&lt;span class="nd"&gt;@ActiveProfiles&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;AbstractBaseIntergrationTestConfiguration&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ACTIVE_PROFILE_NAME_TEST&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@AutoConfigureTestDatabase&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AutoConfigureTestDatabase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Replace&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NONE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@ContextConfiguration&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initializers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AbstractBaseIntergrationTestConfiguration&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;DockerPostgreDataSourceInitializer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AbstractBaseIntergrationTestConfiguration&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="no"&gt;JDBC_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"jdbc.url="&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="no"&gt;JDBC_USERNAME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"jdbc.username="&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="no"&gt;JDBC_PASSWORD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"jdbc.password="&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="no"&gt;JDBC_DRIVER_CLASS_NAME_ORG_POSTGRESQL_DRIVER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"jdbc.driverClassName=org.postgresql.Driver"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="no"&gt;ACTIVE_PROFILE_NAME_TEST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"TestContainerTests"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;//--&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="nc"&gt;PostgreSQLContainer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;?&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;protected&lt;/span&gt; &lt;span class="nc"&gt;ObjectMapper&lt;/span&gt; &lt;span class="n"&gt;objectMapper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ObjectMapper&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;disable&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;SerializationFeature&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;FAIL_ON_EMPTY_BEANS&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Init DB Script here&lt;/span&gt;
        &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PostgreSQLContainer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;POSTGRESQL_IMAGE&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withInitScript&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;INIT_DB_SCRIPT&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withDatabaseName&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;DB_NAME&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withUsername&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;DB_USERNAME&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withPassword&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;start&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;containerDelegate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;JdbcDatabaseDelegate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Adding Database scripts here&lt;/span&gt;
        &lt;span class="nc"&gt;ScriptUtils&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;runInitScript&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;containerDelegate&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MISSING_TABLES_SQL&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;ScriptUtils&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;runInitScript&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;containerDelegate&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;IntegrationTestConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;SAMPLE_DATA_SQL&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// This class adds the DB properties to Testcontainers.&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DockerPostgreDataSourceInitializer&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;ApplicationContextInitializer&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ConfigurableApplicationContext&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

        &lt;span class="nd"&gt;@Override&lt;/span&gt;
        &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ConfigurableApplicationContext&lt;/span&gt; &lt;span class="n"&gt;applicationContext&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

            &lt;span class="nc"&gt;TestPropertySourceUtils&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addInlinedPropertiesToEnvironment&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;applicationContext&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                    &lt;span class="no"&gt;JDBC_DRIVER_CLASS_NAME_ORG_POSTGRESQL_DRIVER&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                    &lt;span class="no"&gt;JDBC_URL&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getJdbcUrl&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt;
                    &lt;span class="no"&gt;JDBC_USERNAME&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getUsername&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt;
                    &lt;span class="no"&gt;JDBC_PASSWORD&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;postgreDBContainer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPassword&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
            &lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to write a test?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Test&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;checkIfUserExistInIdealCase&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

  &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"abc@test.com"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;MockHttpServletRequestBuilder&lt;/span&gt; &lt;span class="n"&gt;postObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;getPostRequestExecutorBuilder&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"http://localhost:8080/v1/checkemail/"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Optional&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;empty&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;MvcResult&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mockMvc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;perform&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;postObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="o"&gt;())).&lt;/span&gt;&lt;span class="na"&gt;andExpect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;isOk&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;andReturn&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getResponse&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;getContentAsString&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;SyncResponseDto&lt;/span&gt; &lt;span class="n"&gt;responseDto&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;objectMapper&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;readValue&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;SyncResponseDto&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

  &lt;span class="n"&gt;assertThat&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;responseDto&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getResponseReturnCode&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;isEqualTo&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResponseReturnCode&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;USER&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;_EXIST&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Advantages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Run Integration Tests offline.&lt;/li&gt;
&lt;li&gt;You run tests against real components, PostgreSQL database instead of the H2 database.&lt;/li&gt;
&lt;li&gt;You can mock AWS services.&lt;/li&gt;
&lt;li&gt;Implementation and tests can be written by developers same time when raising a PR.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Disadvantages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The main limitation is, that containers cannot be reused between test classes.&lt;/li&gt;
&lt;li&gt;Adding “one more” external dependency.&lt;/li&gt;
&lt;li&gt;Takes a bit more time than usual to start a container, 4 - 5 seconds for Postgres VS 0.5 seconds for H2.&lt;/li&gt;
&lt;li&gt;When running locally, local machine should be powerful enough too ;)&lt;/li&gt;
&lt;li&gt;More RAM, More Power as multiple containers can be run.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.testcontainers.org/"&gt;Testcontainer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/testcontainers/testcontainers-java"&gt;Test-Container Java&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.baeldung.com/spring-boot-testcontainers-integration-test"&gt;Testcontainer Example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>docker</category>
      <category>testing</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>GitHub Pull Request Template a faster way to document a PR</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Fri, 29 Oct 2021 19:10:22 +0000</pubDate>
      <link>https://dev.to/cricketsamya/github-pull-request-template-a-faster-way-to-document-a-pr-2k0</link>
      <guid>https://dev.to/cricketsamya/github-pull-request-template-a-faster-way-to-document-a-pr-2k0</guid>
      <description>&lt;h2&gt;
  
  
  Why do you need a Pull Request Template?
&lt;/h2&gt;

&lt;p&gt;Pull Request(PR) are often when raised are not properly documented. The best way to document them is to use a consistent template. The Template will help the team to document the PR in a concise way. PR reviewer gets an idea about what to expect in a PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to add a GitHub PR Template?
&lt;/h2&gt;

&lt;p&gt;Create a file &lt;code&gt;pull_request_template.md&lt;/code&gt; inside a root folder of the repository called &lt;code&gt;./github&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./github/pull_request_template.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file is nothing but a template that will be shown on GitHub PR, when the PR is raised.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sample Template file
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Description
&amp;lt;!-- Please write a brief information about PR, what it contains, its purpose --&amp;gt;

## Link to Jira
&amp;lt;!-- If there is a ticket for this --&amp;gt;

## Screenshots
&amp;lt;!-- Please add screenshots --&amp;gt;

## Testing
&amp;lt;!-- How to test PR --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>github</category>
      <category>markdown</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to configure Dependabot with Gradle</title>
      <dc:creator>Sameer</dc:creator>
      <pubDate>Fri, 22 Oct 2021 09:03:11 +0000</pubDate>
      <link>https://dev.to/cricketsamya/gradle-with-dependabot-1o47</link>
      <guid>https://dev.to/cricketsamya/gradle-with-dependabot-1o47</guid>
      <description>&lt;h2&gt;
  
  
  What is a Github Dependabot?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://dependabot.com/"&gt;Dependabot&lt;/a&gt; provides a way to keep your dependencies up to date. Depending on the configuration, it checks your dependency files for outdated dependencies and opens PRs individually. Then based on requirement PRs can be reviewed and merged. &lt;/p&gt;

&lt;h2&gt;
  
  
  Dependabot with Gradle
&lt;/h2&gt;

&lt;p&gt;Dependabot has a limited &lt;a href="https://dependabot.com/blog/gradle-support/"&gt;support&lt;/a&gt; for Gradle. Dependabot looks for a &lt;code&gt;build.gradle&lt;/code&gt; or a &lt;code&gt;settings.gradle&lt;/code&gt; in your repo, then scans for outdated dependencies and creates a PR based on available updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Issue
&lt;/h3&gt;

&lt;p&gt;The issue aries when dependencies are maintained outside of these two files. Dependabot ONLY and ONLY scans &lt;code&gt;build.gradle&lt;/code&gt; or &lt;code&gt;settings.gradle&lt;/code&gt;. Most of the projects would follow this standard of having versions in these files, but remaining ones wont work at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;There is a &lt;strong&gt;workaround&lt;/strong&gt; to this issue. Follow the steps explained below to tackle this issue.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create &lt;code&gt;dependencies.gradle&lt;/code&gt; file to extract all the dependencies. The file name HAS TO BE &lt;code&gt;dependencies.gradle&lt;/code&gt;, otherwise the solution will not work. (&lt;code&gt;version.gradle&lt;/code&gt; is also not supported!)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;
&lt;span class="n"&gt;ext&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// -- PLUGINS&lt;/span&gt;
    &lt;span class="n"&gt;springBootVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2.5.5"&lt;/span&gt;
    &lt;span class="n"&gt;springDependencyManagementVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1.0.11.RELEASE"&lt;/span&gt;
    &lt;span class="o"&gt;....&lt;/span&gt;

    &lt;span class="c1"&gt;//-- DEPENDENCIES&lt;/span&gt;
     &lt;span class="o"&gt;....&lt;/span&gt;  
     &lt;span class="n"&gt;springFoxBootVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"3.0.0"&lt;/span&gt;
    &lt;span class="n"&gt;hibernateVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"5.4.31.Final"&lt;/span&gt;
    &lt;span class="n"&gt;c3p0Version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.9.5.5"&lt;/span&gt;
    &lt;span class="n"&gt;postgresVersion&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"42.2.10"&lt;/span&gt;
    &lt;span class="o"&gt;....&lt;/span&gt; 
    &lt;span class="n"&gt;supportDependencies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;
            &lt;span class="n"&gt;springfox_boot_starter&lt;/span&gt;            &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"io.springfox:springfox-boot-starter:$springFoxBootVersion"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;hibernate_entitymanager&lt;/span&gt;           &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"org.hibernate:hibernate-entitymanager:$hibernateVersion"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;hibernate_core&lt;/span&gt;                    &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"org.hibernate:hibernate-core:$hibernateVersion"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;c3p0&lt;/span&gt;                              &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"com.mchange:c3p0:$c3p0Version"&lt;/span&gt;
            &lt;span class="n"&gt;hibernate_java8&lt;/span&gt;                   &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"org.hibernate:hibernate-java8:$hibernateVersion"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;postgresql&lt;/span&gt;                        &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"org.postgresql:postgresql:$postgresVersion"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
            &lt;span class="o"&gt;....&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Modify &lt;code&gt;build.gradle&lt;/code&gt; to use &lt;code&gt;dependencies.gradle&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;
&lt;span class="n"&gt;buildscript&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;apply&lt;/span&gt; &lt;span class="nl"&gt;from:&lt;/span&gt; &lt;span class="s1"&gt;'dependencies.gradle'&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;plugins&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="s1"&gt;'org.springframework.boot'&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="s2"&gt;"${springBootVersion}"&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="s1"&gt;'io.spring.dependency-management'&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="s2"&gt;"${springDependencyManagementVersion}"&lt;/span&gt;
    &lt;span class="o"&gt;....&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="o"&gt;....&lt;/span&gt;
    &lt;span class="n"&gt;implementation&lt;/span&gt; &lt;span class="n"&gt;supportDependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;springfox_boot_starter&lt;/span&gt;
    &lt;span class="n"&gt;implementation&lt;/span&gt; &lt;span class="n"&gt;supportDependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hibernate_entitymanager&lt;/span&gt;
    &lt;span class="n"&gt;implementation&lt;/span&gt; &lt;span class="n"&gt;supportDependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hibernate_core&lt;/span&gt;
    &lt;span class="n"&gt;implementation&lt;/span&gt; &lt;span class="n"&gt;supportDependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;c3p0&lt;/span&gt;
   &lt;span class="o"&gt;....&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;....&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add dependabot support with &lt;code&gt;.github/dependabot.yml&lt;/code&gt; file to the project.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;updates&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gradle"&lt;/span&gt; 
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/"&lt;/span&gt; 
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;daily"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Tadaaaa.. On the next run or on a force run of dependency check, if there are updates you should see PRs opened by dependabot.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Dependabot is an amazing tool, to make sure your project gets latest dependencies. But the support of Gradle as compared to Maven is limited when dependencies are not maintained &lt;code&gt;build.gradle&lt;/code&gt; or &lt;code&gt;settings.gradle&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;If you dont want to maintain the versions in these two files, you can tweak your gradle files in a way that dependabot can scan the project and will find out the issues with the dependencies. &lt;/p&gt;

&lt;p&gt;Special Thanks to &lt;a href="https://github.com/sumedhdeshpande"&gt;Sumedh&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dependabot.com/blog/gradle-support/"&gt;Dependabot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/dependabot/dependabot-core"&gt;Dependabot Code Repo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gradle</category>
      <category>github</category>
      <category>dependabot</category>
      <category>maven</category>
    </item>
  </channel>
</rss>
