|
1 | | -# tinystruct maven archetype |
| 1 | +# Kickstart your tinystruct project using the tinystruct-archetype |
| 2 | + |
| 3 | +*A simple way to bootstrap applications with tinystruct 1.7.11* |
| 4 | + |
| 5 | +If you're building an application with the **tinystruct** framework, the easiest way to begin is by using the **tinystruct-archetype**, now available on **Maven Central**. |
| 6 | +It gives you a clean, fully prepared project structure with zero manual setup. |
| 7 | + |
| 8 | +## 🌟 Why Use tinystruct-archetype? |
| 9 | + |
| 10 | +### **1. Instant Project Generation** |
| 11 | + |
| 12 | +One command creates a complete tinystruct application with the correct `pom.xml`, directory layout, and starter code. |
| 13 | + |
| 14 | +### **2. Clean, Consistent Structure** |
| 15 | + |
| 16 | +Your project is generated with tinystruct’s recommended conventions: |
| 17 | + |
| 18 | +* `AbstractApplication` as the base |
| 19 | +* `@Action` for defining routes |
| 20 | +* Ready to run via CLI or as an HTTP service |
| 21 | +* No boilerplate or extra configuration needed |
| 22 | + |
| 23 | +### **3. Built for tinystruct 1.7.11** |
| 24 | + |
| 25 | +Select the version you want (e.g., `1.7.11`), and it's applied automatically. |
| 26 | + |
| 27 | +### **4. No Repo Clone Needed** |
| 28 | + |
| 29 | +Because the archetype is published on Maven Central, you can use it immediately. |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## 🚀 Generate a tinystruct Project (Maven Central) |
| 34 | + |
| 35 | +Simply run: |
2 | 36 |
|
3 | | -This archetype creates a minimal tinystruct application. |
4 | | -## Quick usage |
5 | 37 | ```cmd |
6 | 38 | mvn archetype:generate -DarchetypeGroupId="org.tinystruct" -DarchetypeArtifactId="tinystruct-archetype" -DarchetypeVersion="1.0.1" -DgroupId="com.mycompany" -DartifactId="my-tiny-app" -Dpackage="com.mycompany.app" -DtinystructVersion="1.7.11" -DinteractiveMode="false" |
7 | 39 | ``` |
8 | 40 |
|
9 | | -## Usage with installing the archetype locally |
| 41 | +This creates your new project instantly. |
10 | 42 |
|
11 | | -1. Install the archetype into your local Maven repository: |
| 43 | +--- |
12 | 44 |
|
13 | | -```cmd |
14 | | -mvn clean install |
| 45 | +## 🛠 Build Your Project |
| 46 | + |
| 47 | +```bash |
| 48 | +cd my-tinystruct-app |
| 49 | +mvn clean package |
15 | 50 | ``` |
16 | 51 |
|
17 | | -2. Generate a new project from the archetype (example): |
| 52 | +--- |
18 | 53 |
|
19 | | -```cmd |
20 | | -mvn archetype:generate \ |
21 | | - -DarchetypeCatalog="local" \ |
22 | | - -DarchetypeGroupId="org.tinystruct" \ |
23 | | - -DarchetypeArtifactId="tinystruct-archetype" \ |
24 | | - -DarchetypeVersion="1.0.1" \ |
25 | | - -DgroupId="com.mycompany" \ |
26 | | - -DartifactId="my-tiny-app" \ |
27 | | - -Dpackage="com.mycompany.app" \ |
28 | | - -DtinystructVersion="1.7.11" |
29 | | -``` |
| 54 | +## ▶️ Run Your tinystruct Application |
30 | 55 |
|
31 | | -3. Build the generated project: |
| 56 | +Since tinystruct now uses **HttpServer** as the default HTTP server, the run command becomes: |
32 | 57 |
|
33 | | -```cmd |
34 | | -cd my-tiny-app |
35 | | -mvn clean package |
| 58 | +```bash |
| 59 | +bin/dispatcher start \ |
| 60 | + --import org.tinystruct.system.HttpServer \ |
| 61 | + --import com.example.app.Application |
36 | 62 | ``` |
37 | 63 |
|
| 64 | +Your tinystruct service is now up and running. |
| 65 | + |
38 | 66 | Adjust `tinystructVersion` if needed. The generated project includes a simple `Application` that extends `AbstractApplication` with a sample `hello` action. |
39 | 67 |
|
40 | 68 | ## Notes |
41 | 69 |
|
42 | 70 | - **Java version:** this archetype targets Java 17 by default (see `archetype-resources/pom.xml`). Ensure you have JDK 17+ installed. |
43 | 71 | - **CI:** a sample GitHub Actions workflow is included to build and test the generated projects on push/PR (`.github/workflows/maven.yml`). |
44 | | -- **Maven Wrapper:** consider adding the Maven Wrapper (`mvnw`) to this repository so contributors can build without installing Maven globally. |
45 | | - |
46 | | -## Quick tips |
47 | | - |
48 | | -- To run tests in a generated project use: |
49 | | - |
50 | | -```cmd |
51 | | -mvn test |
52 | | -``` |
53 | | - |
54 | | -- If you plan to publish the archetype, set `tinystructVersion` to a released version and test generation in a clean directory. |
| 72 | +- **Maven Wrapper:** consider adding the Maven Wrapper (`mvnw`) to this repository so contributors can build without installing Maven globally. |
0 commit comments