using LATEST for archetypeVersion always resolves to latest release

179 Views Asked by At

Generating like this achieves the desired result -- generates using latest snapshot.

mvn archetype:generate ^
  --show-version ^
  --settings development-maven-settings.xml ^
  -Dmaven.wagon.http.ssl.insecure=true ^
  -DarchetypeCatalog=local ^
  -DarchetypeGroupId=dev.aherscu.qa ^
  -DarchetypeArtifactId=qa-testing-archetype ^
  -DarchetypeVersion=0.0.9-SNAPSHOT ^
  -DgroupId=com.acme ^
  -DartifactId=testing ^
  -Dversion=0.0.1-SNAPSHOT ^
  -Dpackage=com.acme.testing

The development-maven-settings.xml are as follows:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
          https://maven.apache.org/xsd/settings-1.0.0.xsd">

  <profiles>
    <profile>
      <id>sonatype-snapshots</id>
      <repositories>
        <repository>
          <id>archetype</id>
          <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <checksumPolicy>warn</checksumPolicy>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>

Replacing 0.0.9-SNAPSHOT with LATEST always resolves to 0.0.8. Anyway to make it run with latest snapshot?

1

There are 1 best solutions below

4
roediGERhard On

according to this: Archetype should always use latest version of dependency it is not possible to get the latest release like this, as the 'latest' will always resolve against your local repo, not the remote repo. So I think if you add the dependency as real <dependendcy> with <version>latest</version> to your prject and run the 'install' goal, the jar 0.0.9 jar should be installed to your local repo => now your 'latest' should fetch the real latest one.