Using the Maven Scaffolding to create the Java project template
Create a custom Java project template from the command line
Before starting, if using Azure please make sure that your environment meets all the requirements.
You can customize the deployment of the project running a handful of command lines. Currently, scaffolding is handled by Maven and you can use it by cloning one of the workload repositories and then installing the project as a Maven archetype locally; from there, we can create a new project by using that archetype as a template. To do so we do:
-
Clone any of the Ensono Stacks Java Workloads (
simple-api,stacks-java-cqrsorstacks-java-cqrs-events) -
Navigate to the
<directory you cloned the project into>/javain the terminal -
Then issue the following Maven commands, using the included wrapper:
./mvnw archetype:create-from-project -DpropertyFile=archetype.properties- To create the archetypecd target/generated-sources/archetype- Navigate to the folder it was created in..\..\..\mvnw install- Install the archetype locally
-
Now, navigate to a directory in which you'd like to crate the localized project into
-
To create the project we do:
<path-to-mvn-executable>/mvn archetype:generate \
-DarchetypeGroupId='com.amido.stacks.workloads' \
-DarchetypeArtifactId='<archetype-artifact-id>' \
-DarchetypeVersion='<archetype-version>' \
-DgroupId='<your-group-id>' \
-DartifactId='<your-artifact-id>' \
-Dversion='<your-version>' \
-Dpackage='<your-package-name><archetype-artifact-id>refers to the archetype name ID, as that was created above. That ID is made of the artifact name of the original project as declared in itspom.xmlsuffixed with-archetype- For example:
stacks-api-cqrs-events-archetype. The name can also be observed in the log created from the first command above.
- For example:
<archetype-version>should be taken from thepom.xmlof the original project<your-group-id>is a placeholder for your group ID<your-artifact-id>is a placeholder for your artifact ID<your-version>is a placeholder for your version<your-package-name>is a placeholder for the root package name and structure.- For example, using
com.test.stackswill instruct Maven to place the code insrc/main/java/com/test/stacksand update all the relevant references accordingly (i.e.imports)
- For example, using
For now, until the release of the Ensono Stacks CLI Tool v2 is released, this is the only way to get started with Ensono Stacks.