apache / apache/maven-archetype

[ARCHETYPE-529] Maven archetype:generate does not find local archetypes in interactive mode

Open
#841 0 comments 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
148
Forks
181
Avg merge
1d 20h
Merged PRs (30d)
8

Description

**[Björn Raupach](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=raupach)** opened **[ARCHETYPE-529](https://issues.apache.org/jira/browse/ARCHETYPE-529?redirect=false)** and commented

Hi there,

I have seen other tickets namely ARCHETYPE-519 and ARCHETYPE-528. This might be related. I am not on the dev or user list so I am not sure if this has been discussed. If so, feel free to close this issue, no harm done.

**tl;dr**: Maven 3.5.0 uses maven-archetype-plugin:2.4 and does not find archetypes created with plugin version 3.0.1 in local repository in interactive mode.

We created a Maven archetype for projects with the goal archetype:create-from-project. This went smooth and I can do a mvn install in the archetype projects folder. I can verify that there is an entry in ~/.m2/repository/archetype-catalog.xml

Since this is for internal use we didn't plan to upload the archetype to a repository. Developers should simply checkout the archetype project folder and do a mvn install.

While **in** the archetypes project folder I can see the archetype with mvn archetype:generate. I guess this is because there is a pom.xml in the directory which declares version 3.0.1 in the plugins section.

Now, if go to a different directory and try to generate a quickstart project with mvn archetype:generate the local archetype is missing. However it works in non-interactive mode.

```
mvn archetype:generate
-DarchetypeCatalog=local
-DarchetypeGroupId=
-DarchetypeArtifactId=
...
-DinteractiveMode=false
```

This creates a project based on the archetype but issues a warning during the process.

```
[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo.maven.apache.org/maven2).
[WARNING] Use -DarchetypeRepository= if archetype's repository is elsewhere.
```

Maven 3.5.0 still uses the 2.4 version of the archetype plugin.

---

**Affects:** 3.0.1

2 votes, 2 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with Maven 3.5.0 and maven-archetype-plugin versions 2.4 and 3.0.1, using the shown interactive and non-interactive commands with the local catalog. Trace how interactive mode loads the local catalog outside the archetype project folder and compare it with the working non-interactive path. Done means interactive generation finds the installed local archetype without the central-repository warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.