[英]How can I execute a terminal command when opening IntelliJ Project?
Not even sure if this possible with IntelliJ but I'd like to tie the vagrant up
command to run automatically when I open an IntelliJ project. 甚至不确定IntelliJ是否可行,但是我想在打开IntelliJ项目时将
vagrant up
命令绑定为自动运行。 I've scoured the settings but haven't been able to find anything that gives me this functionality. 我已经搜寻了设置,但是找不到任何可以提供此功能的东西。
You can write a plugin. 您可以编写一个插件。
https://www.jetbrains.com/help/idea/plugin-development-guidelines.html https://www.jetbrains.com/help/idea/plugin-development-guidelines.html
Define an application component in the plugin.xml 在plugin.xml中定义一个应用程序组件
<application-components>
<component>
<implementation-class>com.steve.plugins.recentprojects.RecentProjects</implementation-class>
</component>
</application-components>
And then you implement ApplicationComponent
, which defines these methods in a parent interface: 然后实现
ApplicationComponent
,它在父接口中定义了这些方法:
public interface BaseComponent extends com.intellij.openapi.components.NamedComponent {
default void initComponent() { /* compiled code */ }
default void disposeComponent() { /* compiled code */ }
}
It seems like initComponent()
can be a nice place to insert a function to start vagrant. 看来
initComponent()
可能是插入函数以启动流浪汉的好地方。
Alternatively... externalise the startup, write a script that starts vagrant and then starts intellij... 或者...将启动外部化,编写一个脚本以启动vagrant,然后启动Intellij ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.