Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
369 views
in Technique[技术] by (71.8m points)

How do I share IntelliJ Run/Debug configurations between projects?

I have many different versions of my app. Each one is a separate IntelliJ project. Every time I open a new one, the list of configurations starts blank:

enter image description here

The annoying thing about this is I deploy to 1 VM and I have to copy and paste the debug configurations each time I want to test a different version. IntelliJ makes this dialog modal per IntelliJ Instance, so I can't copy and paste the fields between Project Instances.

I end up taking a screenshot of one configuration and copying the fields by hand into the other project. It's a pretty primitive solution. Is there a more convenient way to get a run configuration from one project to another?

I'm using IntelliJ 13 on Windows 7.


Can I share settings for IntelliJ Idea across different projects? may have the answer to this, but the question is different. It's about window layout. Therefore I don't consider it a duplicate.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The best way to do this is to click the "share" checkmark next to Name field when you edit/create the configuration. You can get to this Dialog with Run > Edit Configurations.

enter image description here

The share check-mark pulls the setting out of your workspace.xml and instead puts it in the directory .idea unConfigurations. This is designed so you can share the setting with others. You could copy this file and put it in the same location in all your idea projects.

However, in the future, you might want to consider using source control branches for app versions rather than separate projects. IntelliJ handles these very well.


UPDATE (June 2021): IntelliJ now puts this in the .run folder as its own file, no longer in .idea/runConfigurations.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...