Task and parameter reference

Distinguish between system properties, interactive defaults, fixed output directories and custom variables.

Task

Taskbehavior
generateRead input parameters and templates and generate results
cleanArchetypeRecursively delete generated/ under the current project

Parameters that will trigger the query

These parameters are first read through System.getProperty; if missing, the interactive prompt is called. The default value is the default answer provided when interacting, batch runs should still pass in all fields explicitly.

System propertiesmeaningInteraction defaults in source codeTemplate variables
groupengineering groupNonegroupId
nameProject nameNoneartifactId
packageNameJava package nameNonepackageName
versionEngineering version1.0.0-SNAPSHOTversion
authorAuthorAdministratorauthor
portapplication port8080port
contextPathcontext path/contextPath

packagePath is derived from packageName, e.g. com.example.demo corresponds to com/example/demo.

Parameters that will not trigger the query

System propertiesDefault valuebehavior
templatessrc/main/resources/templatesTemplate directory, relative or absolute path can be specified
failIfFileExistEnabled by defaultFails when a file with the same name is encountered in the output; setting false will allow overwriting

The README example was passed in -Dtarget=generated, and the current implementation uses the fixed generated/ constant directly and does not read target as the output directory setting.

Configure via gradle.properties

In gradle.properties of the generator project write:

systemProp.group=com.example
systemProp.name=demo-app
systemProp.packageName=com.example.demo
systemProp.version=1.0.0-SNAPSHOT
systemProp.author=developer
systemProp.port=8080
systemProp.contextPath=/demo
systemProp.failIfFileExist=true

The command line uses system properties like -Dgroup=.... -Pgroup=... is a Gradle project property, not a reading entry here in the plugin. The source code has no logic to load any settings.properties files by itself.

Differences between README and current implementation

  • The default value of the README version is written as 1.0-SNAPSHOT, and the current task source code actually uses 1.0.0-SNAPSHOT.
  • README lists configServerName and configServerPort. The current generation task does not have built-in queries and default values for these two fields; please pass the template if required.Custom binding incoming.
  • name is the input parameter, and the standard project name variable in the template is artifactId; group corresponds to groupId.

Parameter parsing source code

Architecture diagram