Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Improve archetype:generate command (#107)
Browse files Browse the repository at this point in the history
* Improve default and descriptions of archetype parameters
* Change variable usage to make POM valid XML
* Update `maven-archetype-plugin`
* Change `artifactId` variable default value
  • Loading branch information
samuelmeuli authored and habansal committed Oct 17, 2019
1 parent 2a068a5 commit d041546
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<!-- ====================================================================== -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.archetype.version>3.0.1</maven.archetype.version>
<maven.archetype.version>3.1.2</maven.archetype.version>
<archetype.test.ignoreEOLStyle>true</archetype.test.ignoreEOLStyle>
<archetype.test.skip>${skipTests}</archetype.test.skip>
</properties>
Expand Down
59 changes: 40 additions & 19 deletions src/main/resources/META-INF/maven/archetype-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,43 +106,64 @@
</includes>
</fileSet>
</fileSets>

<requiredProperties>
<!-- Project name is used for building AEM apps path, content path, conf etc. -->
<!--
PROPERTIES WITHOUT DEFAULTS
(Users will be prompted to provide these)
-->

<!-- `projectTitle`: Descriptive project name (e.g. `My App`) -->
<requiredProperty key="projectTitle" />

<!-- `projectName`: Used for building AEM apps path, content path, conf,
etc. (e.g. `myapp`) -->
<requiredProperty key="projectName">
<validationRegex>^[a-zA-Z0-9\_]+$</validationRegex>
<defaultValue>mysamplespa</defaultValue>
</requiredProperty>
<!-- Project title - descriptive project name -->
<requiredProperty key="projectTitle">
<defaultValue>My Sample SPA</defaultValue>
</requiredProperty>
<!-- Name of the component group -->
<requiredProperty key="componentGroup">
<defaultValue>${projectTitle}</defaultValue>

<!-- groupId: Maven artifact groupId for all projects (e.g.
`com.mycompany`) -->
<requiredProperty key="groupId">
<validationRegex>^[a-zA-Z0-9\.\-_]+$</validationRegex>
</requiredProperty>
<!-- Type of the frontend app project -->

<!-- `optionFrontend`: Frontend framework to use in the generated
project (either `angular` or `react`) -->
<requiredProperty key="optionFrontend">
<validationRegex>^(angular|react)$</validationRegex>
<defaultValue>react</defaultValue>
</requiredProperty>
<!-- Maven artifact groupId for all projects -->
<requiredProperty key="groupId">
<validationRegex>^[a-zA-Z0-9\.\-_]+$</validationRegex>
</requiredProperty>
<!-- Maven artifact "root" artifactId, is suffixed for the individual modules -->

<!--
PROPERTIES WITH DEFAULTS
(Users will not be prompted for these unless they answer the
confirmation prompt with "N", see
https://issues.apache.org/jira/browse/ARCHETYPE-308)
-->

<!-- `artifactId`: Maven artifact "root" artifactId, is prefixed to the
individual modules (e.g. `com.mycompany.myapp`) -->
<requiredProperty key="artifactId">
<validationRegex>^[a-zA-Z0-9\.\-_]+$</validationRegex>
<defaultValue>${groupId}.${projectName}</defaultValue>
<defaultValue>${projectName}</defaultValue>
</requiredProperty>
<!-- Java class package name -->

<!-- `package`: Java class package name (e.g. `com.mycompany.myapp`) -->
<requiredProperty key="package">
<validationRegex>^[a-z0-9\.]+$</validationRegex>
<defaultValue>${groupId}.${projectName}</defaultValue>
</requiredProperty>
<!-- Maven artifact version - e.g. 1.0.0-SNAPSHOT -->

<!-- `version`: Maven artifact version (e.g. `1.0.0-SNAPSHOT`) -->
<requiredProperty key="version">
<validationRegex>^\d+(\.\d+){0,2}(\-SNAPSHOT)?$</validationRegex>
<defaultValue>1.0.0-SNAPSHOT</defaultValue>
</requiredProperty>

<!-- `componentGroup`: Name of the component group in the AEM Editor
(e.g. `My App`) -->
<requiredProperty key="componentGroup">
<defaultValue>${projectTitle}</defaultValue>
</requiredProperty>
</requiredProperties>
</archetype-descriptor>
5 changes: 1 addition & 4 deletions src/main/resources/archetype-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
<!-- ====================================================================== -->
<modules>
<module>core</module>
#if (${optionFrontend} == 'angular') <module>angular-app</module>
#end
#if (${optionFrontend} == 'react') <module>react-app</module>
#end
<module>${optionFrontend}-app</module>
<module>ui.apps</module>
<module>ui.content</module>
<module>all</module>
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/projects/angular/reference/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<!-- ====================================================================== -->
<modules>
<module>core</module>
<module>angular-app</module>
<module>ui.apps</module>
<module>angular-app</module>
<module>ui.apps</module>
<module>ui.content</module>
<module>all</module>
</modules>
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/projects/react/reference/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
<!-- ====================================================================== -->
<modules>
<module>core</module>
<module>react-app</module>
<module>ui.apps</module>
<module>react-app</module>
<module>ui.apps</module>
<module>ui.content</module>
<module>all</module>
</modules>
Expand Down

0 comments on commit d041546

Please sign in to comment.