【问题标题】:Open multiple instances of STS via a command line on a Mac?在 Mac 上通过命令行打开多个 STS 实例?
【发布时间】:2019-03-28 02:50:05
【问题描述】:

我试图让多个版本的 STS 通过命令行参数从它们自己的工作区开始,并尝试将 this 作为参考。

结果是:

$open -a ~/Applications/STS.app --args -clean
FSPathMakeRef(/Users/xxx/Applications/STS.app) failed with error -43.

STS 的可执行文件在哪里?

我在MacOS High Sierra v.10.13.6

据我所知,STS 最初是作为spring-tool-suite-3.9.3.RELEASE-e4.7.3-macosx-cocoa-x86_64.dmg 下载并以这种方式安装的。

我在 Mac 上读到,可以右键单击我尝试过的 .app 和“显示包内容”:

但是从命令行访问它仍然不起作用:

$ls -la ~/Applications/STS.app/Contents
ls: /Users/simeonleyzerzon/Applications/STS.app/Contents: No such file or directory

根据@greg-449 的评论,我现在正在尝试打开 STS 并将其指向另一个工作区位置:

$ open -a /Applications/STS.app -data /temp
open: invalid option -- d
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s <partial SDK name>][-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.
      If the file is in the form of a URL, the file will be opened as a URL.
Options:
      -a                Opens with the specified application.
      -b                Opens with the specified application bundle identifier.
      -e                Opens with TextEdit.
      -t                Opens with default text editor.
      -f                Reads input from standard input and opens with TextEdit.
      -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
      -R, --reveal      Selects in the Finder instead of opening.
      -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
          --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
      -n, --new         Open a new instance of the application even if one is already running.
      -j, --hide        Launches the app hidden.
      -g, --background  Does not bring the application to the foreground.
      -h, --header      Searches header file locations for headers matching the given filenames, and opens them.
      -s                For -h, the SDK to use; if supplied, only SDKs whose names contain the argument value are searched.
                        Otherwise the highest versioned SDK in each platform is used.

【问题讨论】:

  • 应用程序是 /Applications - 在根文件系统中,不在您的主目录中,所以没有 ~
  • 谢谢@greg-449。关于 MacOS 引用另一个工作区位置(通过 -data)的语法的任何想法。这似乎不适用于Mac?我正在尝试这个:open -a /Applications/STS.app -data /temp
  • 不确定您的意思。/Applications 位置是安装目录而不是工作区。正常的 Unix 路径应该适用于 -data 上的工作区位置。
  • @greg-449:应该,但似乎没有,也许我遗漏了一些引号之类的东西。我已经更新了这个问题,澄清了这部分。
  • 您在打开命令中缺少 --args - 查看答案

标签: spring eclipse macos spring-tool-suite sts-springsourcetoolsuite


【解决方案1】:

应用程序是 /Applications - 在根文件系统中而不是在您的主目录中,所以没有 ~

就这样:

ls -la /Applications/STS.app/Contents

对于您的 open 命令,您缺少 --args 选项,该选项告诉 open 命令行的其余部分用于应用程序:

open -a /Applications/STS.app --args -data /temp

【讨论】:

  • 所以,我现在使用open -a /Applications/STS.app --args -data ~/workspace/spring-security/ -clean -showlocation -vmargs -Xmx1024m -XX:MaxPermSize=256m,它会打开 STS。但是,通常当 Eclipse 在新工作区中打开时,会在该工作区目录中创建一个新的 .metadata 文件。使用上面的命令,这不会以某种方式发生。我还缺少什么吗?
  • 我正在尝试对 Mac OS 中的行为进行建模,类似于我在 Windows 中看到的行为,其命令类似于:open -a /Applications/STS.app --args -data ~/workspace/spring-security/ -clean -showlocation -vmargs -Xmx1024m -XX:MaxPermSize=256m
  • 以'.'开头的文件和目录在 macOS 中默认隐藏。 .metadata 已创建,但 Finder 不显示它。 ls -a 将显示它。在最新版本的 macOS 上按 Cmd+Shift+。 (dot) 将显示隐藏文件。
猜你喜欢
  • 1970-01-01
  • 2015-03-11
  • 1970-01-01
  • 2019-03-29
  • 1970-01-01
  • 2020-05-26
  • 2015-12-20
  • 2015-12-21
  • 2013-03-16
相关资源
最近更新 更多