
# Helidon Archetypes

These are scripts for creating and deploying the Helidon quickstart archetypes.
To simplify ongoing maintenance of the quickstart examples and archetypes
we generate the archetypes on the fly using the create-from-project goal
of the archetype plugin.

Unfortunately archetype:create-from-project is designed to be run by a
human against the pom.xml of the project you want to create the archetype
for. There was not an obvious way to run it from another project (pom) and
point it at the example project.

We also want to keep the example pom's clean, which further limits our
option (don't want any archetype configuration in the example poms).

So, we resorted to the following scripts:

* `create-archetypes.sh helidon-version`: Iterates over the quickstart examples
  and creates the archetypes. This script uses `archetypes.properties` as
  input to get values for version and group id.

* `set-version.sh [helidon-version]`: iterates over the
  quickstart examples' poms and changes the helidon.version property in the
  poms to be the specified version. If helidon-version is not
  passed then the scripts looks for RELEASE_FULL_VERSION in the environment.
  Also updates `archetype.properties` to update the archetype version.
  This script is used during a release of the SDK to ensure that the
  examples (generated by the archetypes) use the released version of
  the SDK bom pom.
  
* `deploy-archetypes.sh [helidon-version]`: calls create-archetypes.sh
   to create and build the archetypes, and then deploys them. If
   helidon-version is not passed then the scripts looks for RELEASE_FULL_VERSION
   in the environment. This script is used during a release of the SDK
   to release the archetypes.

Remember, all of this wierd stuff is because we want to create the
archetypes on the fly. An alternative would be to recreate the 
archetypes manually whenever we change the examples, and check
in the archetype source as a maven module. But that then makes
maintenance of the quickstart examples less convenient.

## Making changes to quickstart examples and trying the archetypes

For local development you can change the examples at will
and try them out. Once you are done messing with the examples
and you want to try out the archetypes, do this:

```
bash create-archetypes.sh 
```

You can then try an archetype (which should now be in your local maven
repo):

```
# Use whatever archetypeVersion you used above 
mvn archetype:generate -DinteractiveMode=false \
 -DarchetypeGroupId=io.helidon.archetypes -DarchetypeArtifactId=helidon-quickstart-se \
 -DarchetypeVersion=0.0.1-SNAPSHOT \
 -DgroupId=io.helidon.examples -DartifactId=quickstart-se -Dpackage=io.helidon.examples.quickstart.se
```

## If you add a new quickstart example

If you add a new example, you'll want to add it to the examples lists in
each shell scripts. Apologies for violating DRY.

## If you want to change the archetype group id

Update archetype.groupId in `archetype.properties` to use the new archetype groupid.

