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

Locally installed archetypes not detected #82

Closed
fireflowerr opened this issue Jul 16, 2018 · 6 comments · Fixed by #86
Closed

Locally installed archetypes not detected #82

fireflowerr opened this issue Jul 16, 2018 · 6 comments · Fixed by #86
Assignees
Labels
feature-request New feature or request
Milestone

Comments

@fireflowerr
Copy link

Installing an archetype and updating the local-catalog to contain said archetype does not cause it to appear in the list of available archetypes from the Maven: Generate from Maven Archetype command. I have verified that my archetype is correctly installed by cat'ng the local-catalog as well as generating a project using the archetype from the command line.

OS: Debian Stretch

@Eskibear
Copy link
Member

@paroxayte Could you share the way you are using local-catalog? So we can think about how to improve the experience?

@Eskibear
Copy link
Member

Forgot to say, yes, currently it only fetches the catalog from maven central repo, and caches it locally. The drop list of maven archetypes is loaded from the cached catelog. So we want to know how you install your archetype, and how to get the list of archetypes installed to local-catalog, and how you use command line to generate projects from that archetype. It would help a lot. Thanks.

@fireflowerr
Copy link
Author

fireflowerr commented Jul 16, 2018

@Eskibear Yes, certainly! When installing an archetype from source I run

mvn install archetype:update-local-catalog
mvn archetype:crawl

You can similarly do this with install:install-file and a local archetype jar.
Doing this causes ~/.m2/repository/archetype-catalog.xml to either be created or updated to contain identifcation data for your archetype. For my archetype in this case the generated entry is:

<archetype>
  <groupId>paroxayte</groupId>
  <artifactId>cs2Template</artifactId>
  <version>1.1</version>
  <description>cs2Template</description>
</archetype>

Then to generate a project from the now installed archetype I cd into my workspace directory and run
mvn archetype:generate -B -DarchetypeGroupId=paroxayte -DarchetypeArtifactId=cs2Template -DgroupId=paroxayte -DartifactId=test -Dversion=1.0 or you can do it interactively by witholding the '-B' flag and just supplying the archetypeGroupId and archetypeArtifactId. The archetype-catalog-.xml file is very simple with the only attributes I've encountered being the ones you see here plus opening and closing attribute <archetypes>

@Eskibear
Copy link
Member

Yes, by executing mvn install archetype:update-local-catalog I find ~/.m2/repository/archetype-catalog.xml created. But install:install-file doesn't work for me.

Plan

  1. read archetypes from ~/.m2/repository/archetype-catalog.xml if it exists.
  2. show archetypes in local-catalog together with the recommended archetypes in the 1st page.

Do you think this works for you and other local-catalog users ?

@Eskibear Eskibear self-assigned this Jul 16, 2018
@Eskibear Eskibear added the feature-request New feature or request label Jul 16, 2018
@fireflowerr
Copy link
Author

fireflowerr commented Jul 16, 2018

Yes, I believe this plan would cover most/all local catalog users. Note that if you use mvn install:install-file to install an archetype from local jar, you also have to point at the archetype pom when you update the catalog. Eg: mvn -f ./cs2Template.pom archetype:update-local-catalog

@Eskibear
Copy link
Member

Fixed in PR #86 . Will be shipped with v1.0.0. You can checkout the latest code if you want to try it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants