apache / apache/maven-archetype

[ARCHETYPE-561] Plugin picks 1.0 version of archetype when versionId not specified

Open
#556 2 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

**[Bruno Borges](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=bruno.borges)** opened **[ARCHETYPE-561](https://issues.apache.org/jira/browse/ARCHETYPE-561?redirect=false)** and commented

When creating a project out of an archetype without specifying -DarchetypeVersion, the generator will use version 1.0, even though the maven-metadata.xml points to a later version.

The command is the following, for a clean user local repository Maven setup: 

```java
mvn archetype:generate \
  -DarchetypeGroupId='com.microsoft.azure' \
  -DarchetypeArtifactId='azure-functions-archetype' \
  -DgroupId='com.function.hello' \
  -DartifactId='helloworld' \
  -Dversion='1.0-SNAPSHOT' \
  -Dpackage='com.function.hello' \
  -DappName='helloworld-1554551180252' \
  -B -DarchetypeCatalog=internal
```

Now, even though -DarchetypeCatalog=internal is provided, and because the archetype does not exist in the local repository, Maven does download version 1.0 of this archetype's groupId/artifactId by default, ignoring the \ version specified in Maven Central's maven-metadata.xml

As one can see in the maven-metadata.xml [1], the latest version is 1.21 (or higher).

[1] https://repo1.maven.org/maven2/com/microsoft/azure/azure-functions-archetype/maven-metadata.xml

---

**Affects:** 3.0.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided mvn archetype:generate command and inspect how the archetype plugin resolves a missing -DarchetypeVersion when -DarchetypeCatalog=internal is used. Compare the selected version with the latest value in Maven Central's maven-metadata.xml. Done means the reproducer selects the current metadata version instead of version 1.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
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.