Archetypes Release

DukeScript Maven Archetypes 0.41 Released!

We’re excited to announce the release of DukeScript Maven Archetypes version 0.41! This release brings improvements and updates to help you quickly bootstrap your cross-platform Java applications.

What is DukeScript?

DukeScript is a technology that allows you to write applications in Java and HTML5 that run everywhere - on desktop (Windows, Mac, Linux), mobile (iOS, Android), and in the browser. Write once, run anywhere has never been more real!

What’s New in 0.41?

This release includes:

  • Updated dependencies to the latest stable versions
  • Improved project templates for faster development starts
  • Better integration with modern IDEs
  • Enhanced documentation and examples
  • Bug fixes and performance improvements

Getting Started

To create a new DukeScript project using the Maven archetypes, simply run:

    mvn archetype:generate \
      -DarchetypeGroupId=com.dukescript.archetype \
      -DarchetypeArtifactId=knockout4j-archetype \
      -DarchetypeVersion=0.41

Maven will prompt you for:

  • groupId: Your organization’s ID (e.g., com.yourcompany)
  • artifactId: Your project name
  • version: Your project version (default: 1.0-SNAPSHOT)
  • package: Base package for your Java classes

Available Archetypes

1. knockout4j-archetype

The standard archetype for creating DukeScript applications:

    mvn archetype:generate \
      -DarchetypeGroupId=com.dukescript.archetype \
      -DarchetypeArtifactId=knockout4j-archetype \
      -DarchetypeVersion=0.41

2. crud4j-archetype

For creating CRUD (Create, Read, Update, Delete) applications:

    mvn archetype:generate \
      -DarchetypeGroupId=com.dukescript.archetype \
      -DarchetypeArtifactId=crud4j-archetype \
      -DarchetypeVersion=0.41

3. visual-archetype

For applications with rich visual components:

mvn archetype:generate \
  -DarchetypeGroupId=com.dukescript.archetype \
  -DarchetypeArtifactId=visual-archetype \
  -DarchetypeVersion=0.41

Building and Running Your Project

After creating your project, navigate to the project directory and run:

cd your-project-name
mvn clean install
mvn -f client/pom.xml process-classes exec:exec

This will compile your project and launch it in the default desktop browser view.

Multi-Platform Deployment

To build for different platforms:

Desktop (JavaFX)

mvn -f client-javafx/pom.xml clean package

Web Browser

mvn -f client-web/pom.xml clean package

Android

mvn -f client-android/pom.xml clean package

iOS

mvn -f client-ios/pom.xml clean package

Example: Quick Hello World

Here’s a simple example of what your main view model might look like:

package com.example;

import net.java.html.json.Model;
import net.java.html.json.Property;

@Model(className = "HelloWorld", targetId = "", properties = {
    @Property(name = "message", type = String.class)
})
public class HelloWorldModel {
    
    public static void onPageLoad() {
        HelloWorld model = new HelloWorld("Hello from DukeScript 0.41!");
        model.applyBindings();
    }
}

And the corresponding HTML:

<!DOCTYPE html>
<html>
<head>
    <title>DukeScript Hello World</title>
    <meta charset="UTF-8">
</head>
<body>
    <h1 data-bind="text: message"></h1>
</body>
</html>

Resources and Support

Migration from Previous Versions

If you’re upgrading from an earlier version, update your parent POM version:

<parent>
    <groupId>com.dukescript</groupId>
    <artifactId>maven-parent</artifactId>
    <version>0.41</version>
</parent>

Conclusion

DukeScript Maven Archetypes 0.41 makes it easier than ever to create cross-platform Java applications. Whether you’re building enterprise applications, mobile apps, or web services, DukeScript provides the tools you need to write once and deploy everywhere.

Happy coding with DukeScript!


Have questions or feedback? Join our community forum or file issues on GitHub. We’d love to hear about what you’re building with DukeScript!