Skip to content

Add UpgradeCommandlet to automatically update to the latest release of IDEasy #786

@hohwille

Description

@hohwille

As a IDEasy user, I want to be able to upgrade to the latest version of IDEasy so that I do not have to check for new versions, manually download and re-install IDEasy.
This should happen via ide upgrade (what will install the latest IDEasy product version if not already installed - unlike ide update what will update my current project to the latest state).
Therefore an UpgradeCommandlet shall be implemented.

The old mechanism in devonfw-ide for this feature was devon ide update scripts and the code can be found here:
https://github.com/devonfw/ide/blob/9efaf926f1daa4e1e37a22fc89081255fbf55dab/scripts/src/main/resources/scripts/command/ide#L47-L66
The key to find the latest version is https://repo1.maven.org/maven2/com/devonfw/tools/IDEasy/ide-cli/maven-metadata.xml
and for SNAPSHOTs https://s01.oss.sonatype.org/content/repositories/snapshots/com/devonfw/tools/IDEasy/ide-cli/maven-metadata.xml

  • As a preparation a first PR could create a MavenRepository implementing ToolRepository with a mapping from tool and edition to groupId and artifactId (as a starting point this can be hardcoded). It should support parsing maven-metadata.xml to implement resolveVersion.
    The download method can be implemented straight forward reusing existing download functionality we already have implemented after mapping and building the download URL. Theoretically findDependencies could be implemented via pom but we do not want or need this yet and simply return an empty List here.
    Then we can make the MavenRepository accessible via IdeContext.
  • Once all this is done (in another PR after merging the first or in the same PR), the run method of UpgradeCommandlet can use the MavenRepository to resolve the latest version, compare it with the current version (IdeVersion.get() converted to VersionIdentifier). If a newer version is available, then download it. Finally extract the download to $IDE_ROOT/_ide overwriting all files. The latter part may be tricky on Windows due to file locks.
  • As an advanced feature if the current version of IDEasy is a SNAPSHOT, then the MavenRepository should be created with https://s01.oss.sonatype.org/content/repositories/snapshots as base URL instead of https://repo1.maven.org/maven2.
    Further, we currently cannot distinguish different SNAPSHOT versions.
    Therefore I propose a new sub-task story:
  • unique SNAPSHOT versions #791

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestupgradeupgrade of IDEasy to latest version

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions