Skip to content

IdeToolCommandlet: add option and support for import of project(s) #516

@hohwille

Description

@hohwille

As a IDEasy user, I want to be able to clone my repositories and automatically import them into my IDE so that I can avoid manual steps and save time and work.

$ devon eclipse help
...
usage: devon eclipse [options] [args]

Manage Eclipse IDE and workspace.

Arguments:
 --all                           if provided as first arg then to command will be invoked for each workspace
 setup                           setup Eclipse (install or update)
 add-plugin «id» [«url»]         install an additional plugin
 run | start                     launch Eclipse IDE (default if no argument is given)
 ws-up[date]                     update eclipse workspace
 ws-re[verse]                    reverse merge changes from workspace into settings
 ws-reverse-add                  reverse merge adding new properties
 create-script                   create eclipse-main script if not already exists
 import «path» [«workingsets»]   import projects in «path» into current workspace. «workingsets» comma-separated list of workingsets (no spaces between ,), eg: ./myproject ws1,ws2
 -b | --batch         run in non-interactive mode (do not ask any questions).
 -q | --quiet         be quiet and avoid output.
 -d | --debug         be extra verbose and print more output for debugging.
 -f | --force         force proceeding even in case of warnings.

So in devonfw-ide at least for Eclipse we have been somehow supporting this use-case via devon eclipse import «path» [«workingsets»].
Further in repositories this can also be configured to happen automatically on project creation:
https://github.com/devonfw/ide-settings/blob/f1021147b17fa3f1e04c31be3a1b2e74b96926fe/repositories/IDEasy.properties#L4

However, currently this functionality is not implemented in IDEasy what is expected to change with this story.
We only need to support a maven import of the project as starting point.
Optionally for the future also gradle import or other features would be nice to have.
Please note that we do not add individual CLI options to tool commandlets. Instead we would this as new feature to RepositoryCommandlet.
IMHO we could add distinct CLI args to RepositoryCommandlet so that the user tell what to do

ide --import=eclipse <repository>

However, feel free to create a separate story for this to keep PRs smaller.

The feature with its CLI options should be build into IdeToolCommandlet and the concrete implementation to trigger the project import should then be implemented per concrete IDE in its own PR:

  • Eclipse
  • IdeaBasedIdeCommandlet (Intellij, AndroidStudio)
  • VsCode

Please note that so far we have never implemented this for anything else than Eclipse in devonfw-ide.
For IntelliJ users always had to manually do Add Maven Projects option. It would be nice if that could also be automated and the same for VsCode.
Hint: For simplicity it is fair to implement this with just getContext().error("Import not yet implemented: https//github.com/devonfw/IDEasy/issues/«issue-id»") after creating and linking an according issue for the dedicated IDE.
p.s.: A feature to remove projects from an IDE is intentionally not planned. Users can do that manually any time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions