Project Layout

Project Layout

Directory structure

After running latte init web (with group org.example, name hello-web) you’ll have a layout like this:

hello-web/
├── .gitignore
├── project.latte
├── src/
│   ├── main/
│   │   └── java/
│   │       ├── module-info.java
│   │       └── org/example/hello_web/Main.java
│   └── test/
│       └── java/
│           ├── module-info.java
│           └── org/example/hello_web/tests/MainTest.java
└── web/
    ├── static/
    └── templates/
        └── index.jte

The project is a JPMS module with a separate test module. The web/static directory holds static assets (CSS, JavaScript, images) served by the StaticResources middleware, and web/templates holds the JTE templates the app renders. See Static Files and Templates for how they’re wired up.

Project file

project.latte is a Groovy DSL that the Latte CLI reads. The template wires up:

  • A compile dependency on org.lattejava:web (which transitively pulls in org.lattejava:http and org.lattejava:jwt)
  • A test dependency on TestNG
  • The dependency, idea, java, java-testng, and release-git plugins
  • Targets for clean, build, test, run, int, and release

The most relevant target for development is run, which builds the project and launches the Main class:

target(name: "run", description: "Runs the web server", dependsOn: ["build"]) {
  java.run(main: "org.example.hello_web.Main")
}

Because the java plugin builds the project as a module (a module-info.java is present), your application runs on the module path with org.lattejava.web and its transitive dependencies resolved as named modules. That’s what makes import module org.lattejava.web work in Main.java. See the Java Plugin docs for the run target’s full options.

Common commands

CommandWhat it does
latte runRuns Main.java directly (fastest dev loop)
latte buildCompiles and JARs the project
latte testCompiles, JARs, and runs TestNG
latte cleanRemoves build artifacts

For details on the Latte CLI, see the CLI documentation.