Skip to content

Archetype that creates a project that makes use of the marchtyper Maven plugin.

License

Notifications You must be signed in to change notification settings

fuinorg/marchetyper-archetype

Repository files navigation

marchetyper-archetype

Generates a Maven Archetype that creates a marchetyper based project.

Java Maven Build Maven Central LGPLv3 License Java Development Kit 11

Getting started

Now you have a nice project you want to create a Maven Archetype from.

Here are the steps to create the necessary project structure and add your example to it:

Select the coordinates for your project

Let's assume you have created a nice Java FX project you want to use for an Archetype. The following parameters may be a good choice for creating the new archetype:

Variable Your value Description
groupId com.mycompany.archetypes Your archetype's Group ID
artifactId java-fx-archetype Your archetype's Artifact ID
version 0.1.0-SNAPSHOT Your archetype's version
pkgName com.mycompany.archetypes.javafx The base package of your archetype
appName JavaFX Camelcase name of your app

Generate the directory structure

mvn archetype:generate \
     -DarchetypeGroupId=org.fuin.archetypes \
     -DarchetypeArtifactId=marchetyper-archetype \
     -DarchetypeVersion=0.3.1 \
     -DgroupId="com.mycompany.archetypes" \
     -DartifactId="java-fx-archetype" \
     -Dversion="0.1.0-SNAPSHOT" \
     -DpkgName="com.mycompany.archetypes.javafx" \
     -DappName="JavaFX" \

⚠️ Make sure to use the latest stable version from Maven Central for the archetypeVersion (See top of the page).

Copy your example into the new project

The new project structure looks like this:

  • archetype - The code for the generated archetype will be stored in this directory. CAUTION: Content in this directory will be overwritten during every build!
  • example <--- Copy your example project into this directory (The 'pom.xml' should not reference the parent POM - The project is completely independent of the other modules)
  • marchetyper - Contains the plugin and configuration that transforms the example folder into the archetype directory
  • test - Contains code to test the final archetype by generating a test project

Adjust the configuration

Open the marchetyper configuration: marchetyper/marchetyper-config.xml and adjust it to match your project. Basically you define the search and replace operations for your example project. See the configuration section for more information.

Run the build

Execute mvn clean install in the top folder of the project.

Verify the archetype

Take a look at the archetype directory and check if all parts have been replaced with variables like "path" (for path or file names) and "${artifactId}" inside the files. In case there are things that are not OK, adjust the marchetyper/marchetyper-config.xml and run the build again.

In case your archetype looks good, you should generate a new project with the archetype:

mvn archetype:generate \
     -DarchetypeGroupId=com.mycompany.archetypes \
     -DarchetypeArtifactId=java-fx-archetype \
     -DarchetypeVersion=0.1.0-SNAPSHOT \
     ...
     -DarchetypeCatalog=local

It will create a new directory named 'java-fx-archetype' with the project generated with your archetype.

Open the project and verify that it meets your expectation. In case it does not, repeat the change/build/test cycle.

Build

See BUILD.md for information about building this project.

About

Archetype that creates a project that makes use of the marchtyper Maven plugin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published