Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README to reflect maven-archetype-plugin version requirements #400

Closed
id-keenan opened this issue May 21, 2020 · 1 comment
Closed

Comments

@id-keenan
Copy link

I ran into an issue generating a new project using the archetype version 23 - I would get this output:

[INFO] project created from Archetype in dir: /Users/ryankeenan/spa-test/archetype-test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.875 s
[INFO] Finished at: 2020-05-21T12:17:32-06:00
[INFO] Final Memory: 15M/305M
[INFO] ------------------------------------------------------------------------
Ryan-Keenan:spa-test ryankeenan$ cd archetype-test/
Ryan-Keenan:archetype-test ryankeenan$ ll
total 80
drwxr-xr-x  17 ryankeenan  staff    544 May 21 12:17 .
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 ..
-rw-r--r--   1 ryankeenan  staff   1139 May 21 12:17 .gitignore
-rw-r--r--   1 ryankeenan  staff   3344 May 21 12:17 README.md
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 all
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 core
drwxr-xr-x   6 ryankeenan  staff    192 May 21 12:17 dispatcher.ams
drwxr-xr-x   6 ryankeenan  staff    192 May 21 12:17 dispatcher.cloud
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 it.launcher
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 it.tests
-rw-r--r--   1 ryankeenan  staff  32701 May 21 12:17 pom.xml
drwxr-xr-x   5 ryankeenan  staff    160 May 21 12:17 ui.apps
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 ui.apps.structure
drwxr-xr-x   4 ryankeenan  staff    128 May 21 12:17 ui.content
drwxr-xr-x  16 ryankeenan  staff    512 May 21 12:17 ui.frontend.angular
drwxr-xr-x  15 ryankeenan  staff    480 May 21 12:17 ui.frontend.general
drwxr-xr-x  12 ryankeenan  staff    384 May 21 12:17 ui.frontend.react

The output said success, but as is evident from the output of ll - there are too many modules (and the project doesn't even build). Upon running the archetype generation with -X I saw [DEBUG] - ignored resource META-INF/archetype-post-generate.groovy - which means that all the groovy code cleaning up the newly generated codebase wasn't running, so everything was staying exactly as-is after the initial generation. After doing a lot of digging I was able to find this Maven blog article which mentions a feature released along with 3.1.0 that enables the usage of the archetype-post-generate.groovy, so I had to check what version was actually in use with the standard mvn archetype:generate. I've been using the same computer for a long while and doing AEM development for years, so my machine has a very extensive (and in places outdated) local Maven repository, which is really the cause of this issue. I had a Maven metadata file at ~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata-central.xml that specified my 'latest' version of maven-archetype-plugin at 2.4 (I'm not the only one - I had coworkers test this locally too to see if it was just "an issue with my machine"). When I instead ran this that specified the actual latest version:

mvn -Padobe-public org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype  -DarchetypeVersion=23 -DgroupId=com.archetype.aem -DappId=archetype-test -DappTitle='Test Project' -DincludeDispatcherConfig=n -DfrontendModule=react

The generation was successful and I saw this log at the end of the output:

[INFO] Executing META-INF/archetype-post-generate.groovy post-generation script

And my structure was as expected (i.e. no dispatcher configs, only ui.frontend with React).

I typed all that just in case anyone else has experienced this issue - based on my coworkers I know I'm not alone in this.

All of that is just to say that it would be good to either modify the command in the README from mvn archetype:generate to either mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate or mvn org.apache.maven.plugins:maven-archetype-plugin:LATEST:generate
Or just a note to people saying 'make sure you use 3.1.0+ of maven-archetype-plugin'.

Expected Behaviour

The sample command provided in the README should work for all users.

Actual Behaviour

Based on the age of the user's machine (and Maven repo) it may not always work.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Run the generation specifying the 2.4 version:

mvn -Padobe-public org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype  -DarchetypeVersion=23

Platform and Version

Java 1.8
Maven 3.3.9

@msagolj
Copy link
Contributor

msagolj commented Aug 27, 2020

@id-keenan updated README with not about minimal required version (68402d2), thank you.

@msagolj msagolj closed this as completed Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants