<?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: Carter</title>
    <description>The latest articles on DEV Community by Carter (@carter907).</description>
    <link>https://dev.to/carter907</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%2F1346198%2F393ff187-9a9b-4309-bf37-ba4f143637f8.png</url>
      <title>DEV Community: Carter</title>
      <link>https://dev.to/carter907</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carter907"/>
    <language>en</language>
    <item>
      <title>Java JDBC + IntelliJ + SQLite - A Beginner's Walkthrough</title>
      <dc:creator>Carter</dc:creator>
      <pubDate>Tue, 17 Dec 2024 05:43:31 +0000</pubDate>
      <link>https://dev.to/carter907/java-jdbc-intellij-sqlite-a-beginners-walkthrough-3e8n</link>
      <guid>https://dev.to/carter907/java-jdbc-intellij-sqlite-a-beginners-walkthrough-3e8n</guid>
      <description>&lt;h2&gt;
  
  
  IntelliJ Community + JDBC + SQLITE
&lt;/h2&gt;

&lt;p&gt;(or any other database)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no build tool required (Maven or Gradle)&lt;/li&gt;
&lt;li&gt;we'll be downloading the sqlite command-line shell (&lt;a href="https://www.sqlite.org/cli.html" rel="noopener noreferrer"&gt;https://www.sqlite.org/cli.html&lt;/a&gt;)

&lt;ul&gt;
&lt;li&gt;this will make it easy to create a database file and use it as our connection in jdbc.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;sqlite drivers from (&lt;a href="https://github.com/xerial/sqlite-jdbc" rel="noopener noreferrer"&gt;org.xerial.sqlite&lt;/a&gt;)&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1: Project Setup
&lt;/h3&gt;

&lt;p&gt;1.1 create a new project&lt;/p&gt;

&lt;p&gt;&lt;code&gt;File &amp;gt; New &amp;gt; Project..&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpb0e9lp5990t2h439jn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgpb0e9lp5990t2h439jn.png" alt=" " width="800" height="713"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;click on &lt;code&gt;New Project&lt;/code&gt;&lt;br&gt;
pick a name for your project (we will be calling it &lt;em&gt;jdbc-test&lt;/em&gt;)&lt;br&gt;
click &lt;code&gt;Create&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;1.2 adding the sqlite driver&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdu38w8ur8zuaf37hzfd4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdu38w8ur8zuaf37hzfd4.png" alt=" " width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;once your new project is created go to&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;File &amp;gt; Project Structure &amp;gt; Libraries&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;click the + sign and then Maven&lt;br&gt;
(you could also download the jar yourself&lt;br&gt;
&lt;a href="https://github.com/xerial/sqlite-jdbc/releases" rel="noopener noreferrer"&gt;sqlite driver jar&lt;/a&gt;,&lt;br&gt;
Maven just does it for you)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl19dwch5qw4g6toil4p6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl19dwch5qw4g6toil4p6.png" alt=" " width="800" height="636"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search for &lt;code&gt;org.xerial.sqlite-driver&lt;/code&gt; and use the latest version (3.42.0.0 as of this commit)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;optional&lt;/em&gt;: you can choose to store your library in a &lt;code&gt;lib&lt;/code&gt; folder for organizational purposes.&lt;/li&gt;
&lt;li&gt;click okay to add the dependency.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Step 2: Getting a Database File with the SQLite
&lt;/h3&gt;

&lt;p&gt;2.1 downloading the tool&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw3f35t3oyg23v6wp5ly0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw3f35t3oyg23v6wp5ly0.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;visit the &lt;a href="https://www.sqlite.org/download.html" rel="noopener noreferrer"&gt;sqlite downloads page&lt;/a&gt;&lt;br&gt;
install the precompiled binaries for your target OS&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;make sure your download has the following description:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;A bundle of command-line tools for managing SQLite database files,&lt;br&gt;
including the command-line shell program, the sqldiff.exe program,&lt;br&gt;
and the sqlite3_analyzer.exe program.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2.1 identifying your tools&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk56y23x3aqtgk8qwx05i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk56y23x3aqtgk8qwx05i.png" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;unzip the downloaded folder and view the contents inside.&lt;/li&gt;
&lt;li&gt;you should see &lt;code&gt;sqldiff&lt;/code&gt;, &lt;code&gt;sqlite3&lt;/code&gt;, and &lt;code&gt;sqlite3_analyzer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;you are only interested in &lt;strong&gt;sqlite3&lt;/strong&gt; for now.&lt;/li&gt;
&lt;li&gt;start sqlite3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.3 using sqlite3 cli&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1vkclmd87ynpclkyi8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1vkclmd87ynpclkyi8l.png" alt=" " width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to create a new database file simply type
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;.save [name-of-database-file]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this will create a new file in the same folder as the sqlite3 application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.4 handling the database resource file&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;move the file into your IntelliJ Community Edition project.&lt;/li&gt;
&lt;li&gt;you can store in the root directory or in some resource folder&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k49dzlkujyxh54l41k8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6k49dzlkujyxh54l41k8.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Using JDBC and SQLite
&lt;/h3&gt;

&lt;p&gt;you are now ready to start using Sqlite and JDBC!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you can learn how to use JDBC through the following resources:

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html" rel="noopener noreferrer"&gt;https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.baeldung.com/java-jdbc" rel="noopener noreferrer"&gt;https://www.baeldung.com/java-jdbc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;look through the source code for a quick example using our newly created database file.&lt;/p&gt;

</description>
      <category>java</category>
      <category>sql</category>
      <category>sqlite</category>
      <category>jdbc</category>
    </item>
    <item>
      <title>Functional Programming in Kotlin pt. 1</title>
      <dc:creator>Carter</dc:creator>
      <pubDate>Fri, 08 Nov 2024 15:43:52 +0000</pubDate>
      <link>https://dev.to/carter907/functional-programming-in-kotlin-pt-1-903</link>
      <guid>https://dev.to/carter907/functional-programming-in-kotlin-pt-1-903</guid>
      <description>&lt;p&gt;In Kotlin you can write pure functions and harness the power of functional programming in a similar fashion to Scala.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Side-Effects&lt;/em&gt; are state changes that persist out side of the local return value of a function. Mutator methods of a class are an example of functions that create side-effects, these kinds of functions are called &lt;em&gt;procedures&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Referential Transparency&lt;/em&gt; is the idea in functional programming where replacing a function call with it's returned result will not change how the program behaves. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Pure Functions&lt;/em&gt; are referentially transparent because they do not create any side-effects.&lt;/p&gt;

&lt;p&gt;The benefit of referential transparency in pure functions show up quiet apparently: The program becomes no less complex to reason about than an algebraic expression.&lt;/p&gt;

&lt;p&gt;Here is an example of a pure function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nc"&gt;Int&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is an example of an impure function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Burger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="py"&gt;eaten&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eaten&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;// changing the state is an example of a side-effect&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;



</description>
      <category>functional</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>An Updated Guide to Maven Archetypes</title>
      <dc:creator>Carter</dc:creator>
      <pubDate>Mon, 11 Mar 2024 15:38:16 +0000</pubDate>
      <link>https://dev.to/carter907/an-updated-guide-to-maven-archetypes-3eah</link>
      <guid>https://dev.to/carter907/an-updated-guide-to-maven-archetypes-3eah</guid>
      <description>&lt;h1&gt;
  
  
  About-Maven-Archetypes
&lt;/h1&gt;

&lt;h3&gt;
  
  
  What is the point?
&lt;/h3&gt;

&lt;p&gt;One of the major goals in programming is to harbour re-usability and scalability. One way in which we can reuse code is by creating a templating system that allows you to quickly get up and running with predefined code that you're confident in. Maven archetypes one example of this system in action. &lt;/p&gt;

&lt;h3&gt;
  
  
  How do I create my own?
&lt;/h3&gt;

&lt;p&gt;You can create your own Maven Archetype by using a Maven Archetype! Using the predefined &lt;code&gt;org.apache.maven.archetypes:maven-archetype-archetype&lt;/code&gt;. Make sure you choose the archetype from Maven Central, as it has the most up-to-date version. You can also safely delete the test directory of the root folder as we this is simply a demonstration. Once you've done that, you can expect the following project structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-archetype/
|-- src/
|   |-- main/
|   |   |-- resources/
|   |   |   |-- archetype-resources/
|   |   |   |   |-- src/
|   |   |   |       |-- main/
|   |   |   |           |-- java/
|   |   |   |           |   |-- App.java
|   |   |   |           |-- test/
|   |   |   |           |   |-- TestApp.java
|   |   |   |-- META-INF/
|   |   |       |-- maven/
|   |   |           |-- archetype-meta.xml  
|   |   |                   
|   |   |-- pom.xml
|-- pom.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  archetype-meta.xml
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;archetype.meta.xml&lt;/code&gt; provides metadata for your archetype such as definitions for folder locations and how they should behave. More specifically, this is where you will define the expected layout&lt;br&gt;
of your source files, tests, and other properties that you will use in your project. Those files are created directly by you in the archetype-resources folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;archetype-descriptor&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"&lt;/span&gt; &lt;span class="na"&gt;xmlns:xsi=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2001/XMLSchema-instance"&lt;/span&gt;
  &lt;span class="na"&gt;xsi:schemaLocation=&lt;/span&gt;&lt;span class="s"&gt;"http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"&lt;/span&gt;  
  &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"${artifactId}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;fileSets&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- fileSets are used to denote some arbitrary group of folders in your project. --&amp;gt;&lt;/span&gt;
      &lt;span class="c"&gt;&amp;lt;!-- per maven project specification, you should have a directory for your java source files --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;fileSet&lt;/span&gt; &lt;span class="na"&gt;filtered=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt; &lt;span class="na"&gt;packaged=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;directory&amp;gt;&lt;/span&gt;src/main/java&lt;span class="nt"&gt;&amp;lt;/directory&amp;gt;&lt;/span&gt;                                                                                                                           
    &lt;span class="nt"&gt;&amp;lt;/fileSet&amp;gt;&lt;/span&gt;                                                                                       
      &lt;span class="c"&gt;&amp;lt;!-- and a directory for your test files --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;fileSet&lt;/span&gt; &lt;span class="na"&gt;filtered=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt; &lt;span class="na"&gt;packaged=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;                                                                                                                        
      &lt;span class="nt"&gt;&amp;lt;directory&amp;gt;&lt;/span&gt;src/test/java&lt;span class="nt"&gt;&amp;lt;/directory&amp;gt;&lt;/span&gt;                                                                                                                           
    &lt;span class="nt"&gt;&amp;lt;/fileSet&amp;gt;&lt;/span&gt;                                                                                                                                                       
  &lt;span class="nt"&gt;&amp;lt;/fileSets&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/archetype-descriptor&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Filtered &amp;amp; Packaged attributes
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;filtered&lt;/code&gt; - You will be using property binding in the java source files to&lt;br&gt;
bootstrap any required properties.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;packaged&lt;/code&gt; - the fileset will be prepended to the package or group-id of the newly created&lt;br&gt;
project.&lt;/p&gt;
&lt;h3&gt;
  
  
  Required Properties
&lt;/h3&gt;

&lt;p&gt;Required properties allow you to specify parameters that will&lt;br&gt;
be queried to the user when building your archetype with the help of &lt;code&gt;mvn achetype:generate&lt;/code&gt;. These properties can have a &lt;code&gt;defaultValue&lt;/code&gt; which will be used if the user does not input any value. these properties are interpolated into the scaffold created in &lt;code&gt;archetype-resources&lt;/code&gt;. You can learn more about this templating is done by checking out the &lt;a href="https://velocity.apache.org/" rel="noopener noreferrer"&gt;Apache Velocity Project&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;requiredProperties&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;requiredProperty&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;defaultValue&amp;gt;&lt;/span&gt;no about specified&lt;span class="nt"&gt;&amp;lt;/defaultValue&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/requiredProperty&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;requiredProperty&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"color"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;requiredProperty&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="s"&gt;"due-date"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;defaultValue&amp;gt;&lt;/span&gt;10 days from today&lt;span class="nt"&gt;&amp;lt;/defaultValue&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/requiredProperty&amp;gt;&lt;/span&gt; 
&lt;span class="nt"&gt;&amp;lt;/requiredProperties&amp;gt;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;here we create a few required properties. Only color will be required by mvn command but all will be queried if interactive mode is remained on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining Properties
&lt;/h3&gt;

&lt;p&gt;To define properties, we use the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;${name-of-property}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is our example template locate in &lt;code&gt;src/main/resources/archetype-resources/main/java/&lt;/code&gt;&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="kn"&gt;package&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;package&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 *
 *  ${about}
 *  due-date: ${due-date}
 */&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&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;"Your favorite color is ${color}"&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;h3&gt;
  
  
  Installing
&lt;/h3&gt;

&lt;p&gt;Installing is a matter of calling &lt;code&gt;mvn clean install&lt;/code&gt; to install the archetype to our local repository, &lt;code&gt;.m2/repository&lt;/code&gt;, which can be found as a hidden folder under your user directory.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generating a project using the Archetype &amp;amp; Final Result
&lt;/h3&gt;

&lt;p&gt;Now it's time to finally generate the template and retrieve it from our&lt;br&gt;
local repository which will be referenced automatically when we call &lt;code&gt;mvn achetype:generate&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;mvn archetype:generate
    -DgroupId=com.example \
    -DartifactId=my-archetype-created \
    -DarchetypeArtifactId=my-new-maven-archetype \
    -DarchetypeGroupId=org.example \
    -DarchetypeVersion=1.0-SNAPSHOT \
    -DinteractiveMode=false \
    -Dcolor=red \
    -Ddue-date=09/05/2023 \
    -Dabout='This project was created using Maven Archetypes, and this text is from the command line'


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

&lt;/div&gt;



&lt;p&gt;This command will generate the project in the current directory&lt;br&gt;
using your artifact id (&lt;code&gt;my-archetype-created&lt;/code&gt; in the above example). Now that we have are project set, we can view the templating taken place in &lt;code&gt;App.java&lt;/code&gt;&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="kn"&gt;package&lt;/span&gt; &lt;span class="nn"&gt;com.example&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 *
 *  This project was created using Maven Archetypes, and this text is from the command line
 *  due-date: 09/05/2023
 */&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;App&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;"Your favorite color is red"&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;



</description>
      <category>java</category>
      <category>maven</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
