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
Choose Your Modules
Identify which modules your application needs based on your requirements.
Add Dependencies
Add the required dependencies to your pom.xml.
Verify Installation
Build your project and verify the dependencies are resolved.
Available Modules
Core Foundation Modules
Essential utilities and patterns used across all modules. < 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
Type-safe measurements and monetary values. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > quantity </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Includes:
Quantity type with units
Money type with currency support
Unit abstraction
JavaMoney (Moneta 1.4.5) integration
Dependencies: Automatically includes common
Business Domain Modules
Accounting
Pricing
Product
Party
Inventory
Ordering
Full double-entry accounting system. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > accounting </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: common, quantitySophisticated pricing calculators and strategies. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > pricing </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: common, quantityProduct catalog and batch management. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > product </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: common, quantityOrganization and party management. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > party </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: commonComprehensive inventory tracking and availability. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > inventory </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: common, quantityComplete order processing system. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > ordering </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: common, quantity
Advanced Modules
Graphs
Rules
Plan vs Execution
Graph algorithms and data structures. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > graphs </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: commonRule engine, predicates, and scoring. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > rules </ artifactId >
< version > 0.0.1-SNAPSHOT </ version >
</ dependency >
Transitive dependencies: commonPlanning and execution tracking. < dependency >
< groupId > com.softwarearchetypes </ groupId >
< artifactId > planvsexecution </ 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:
<? 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:
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:
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
Cannot resolve dependencies
If you see dependency resolution errors:
Ensure you’re using Java 21 or higher: java -version
Clear your Maven cache: mvn dependency:purge-local-repository
Check that the snapshot repository is accessible
Verify your pom.xml syntax is correct
If you see compilation errors:
Verify Java 21 is configured: Check <maven.compiler.source>21</maven.compiler.source>
Ensure your IDE is using Java 21 SDK
Clean and rebuild: mvn clean compile
Check for missing transitive dependencies
Missing classes at runtime
If classes are missing at runtime:
Check the module has all required transitive dependencies
Verify dependency scope (should be compile, not test or provided)
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