Skip to main content

Prerequisites

Before you begin, ensure you have:

Java 21+

Archetypy Oprogramowania requires Java 21 or higher

Maven

The library is distributed as Maven artifacts
Why Java 21? Archetypy Oprogramowania leverages modern Java features including records, pattern matching, sealed types, and virtual threads for clean, performant code.

Maven Configuration

Archetypy Oprogramowania is organized as a multi-module Maven project. You can include only the modules you need.

Parent POM Coordinates

<groupId>com.softwarearchetypes</groupId>
<artifactId>archetypes</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>

Installing Modules

1

Choose Your Modules

Identify which modules your application needs based on your requirements.
2

Add Dependencies

Add the required dependencies to your pom.xml.
3

Verify Installation

Build your project and verify the dependencies are resolved.

Available Modules

Core Foundation Modules

Essential utilities and patterns used across all modules.
pom.xml
<dependency>
    <groupId>com.softwarearchetypes</groupId>
    <artifactId>common</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
Includes:
  • Result<F, S> monad for error handling
  • Preconditions utilities
  • Event system base classes
  • Version management

Business Domain Modules

Full double-entry accounting system.
pom.xml
<dependency>
    <groupId>com.softwarearchetypes</groupId>
    <artifactId>accounting</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
Transitive dependencies: common, quantity

Advanced Modules

Graph algorithms and data structures.
pom.xml
<dependency>
    <groupId>com.softwarearchetypes</groupId>
    <artifactId>graphs</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
Transitive dependencies: common

Complete Example POM

Here’s a complete example for an e-commerce application using multiple modules:
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
         https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>my-ecommerce-app</artifactId>
    <version>1.0.0</version>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <archetypes.version>0.0.1-SNAPSHOT</archetypes.version>
    </properties>

    <dependencies>
        <!-- Archetypy Oprogramowania modules -->
        <dependency>
            <groupId>com.softwarearchetypes</groupId>
            <artifactId>ordering</artifactId>
            <version>${archetypes.version}</version>
        </dependency>
        <dependency>
            <groupId>com.softwarearchetypes</groupId>
            <artifactId>inventory</artifactId>
            <version>${archetypes.version}</version>
        </dependency>
        <dependency>
            <groupId>com.softwarearchetypes</groupId>
            <artifactId>pricing</artifactId>
            <version>${archetypes.version}</version>
        </dependency>
        <dependency>
            <groupId>com.softwarearchetypes</groupId>
            <artifactId>accounting</artifactId>
            <version>${archetypes.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.12.1</version>
                <configuration>
                    <source>21</source>
                    <target>21</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Testing Dependencies

All modules include comprehensive tests using:
  • JUnit Jupiter 5.10.2 - Modern testing framework
  • AssertJ 3.25.3 - Fluent assertions
  • Mockito 5.17.0 - Mocking framework (where needed)
These are included as test scope dependencies automatically.

Compiler Configuration

Java 21 Required - Ensure your Maven compiler plugin is configured for Java 21:
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.12.1</version>
    <configuration>
        <source>21</source>
        <target>21</target>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>

Verifying Installation

After adding dependencies, verify your installation:
mvn clean compile
You should see output indicating successful dependency resolution:
[INFO] --- maven-compiler-plugin:3.12.1:compile (default-compile) @ my-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling X source files to target/classes
[INFO] BUILD SUCCESS

Quick Verification Test

Create a simple test to verify the installation:
VerifyInstallation.java
import com.softwarearchetypes.common.Result;
import com.softwarearchetypes.quantity.money.Money;
import com.softwarearchetypes.quantity.Quantity;
import com.softwarearchetypes.quantity.Unit;

public class VerifyInstallation {
    public static void main(String[] args) {
        // Test Result monad
        Result<String, Integer> success = Result.success(42);
        System.out.println("Result test: " + success.getSuccess());
        
        // Test Money type
        Money price = Money.of(99.99, "USD");
        System.out.println("Money test: " + price);
        
        // Test Quantity
        Quantity qty = Quantity.of(5, Unit.pieces());
        System.out.println("Quantity test: " + qty);
        
        System.out.println("✓ Installation verified successfully!");
    }
}
Run it:
mvn exec:java -Dexec.mainClass="VerifyInstallation"

Troubleshooting

If you see dependency resolution errors:
  1. Ensure you’re using Java 21 or higher: java -version
  2. Clear your Maven cache: mvn dependency:purge-local-repository
  3. Check that the snapshot repository is accessible
  4. Verify your pom.xml syntax is correct
If you see compilation errors:
  1. Verify Java 21 is configured: Check <maven.compiler.source>21</maven.compiler.source>
  2. Ensure your IDE is using Java 21 SDK
  3. Clean and rebuild: mvn clean compile
  4. Check for missing transitive dependencies
If classes are missing at runtime:
  1. Check the module has all required transitive dependencies
  2. Verify dependency scope (should be compile, not test or provided)
  3. Use mvn dependency:tree to inspect the dependency tree

Next Steps

Quickstart Tutorial

Build your first order processing application

Module Documentation

Explore detailed documentation for each module

API Reference

Browse the complete API reference

Examples

Learn from practical examples and tutorials

Build docs developers (and LLMs) love