在Eclipse中使用项目存储运行配置 [英] Store run configuration with project in Eclipse

查看:104
本文介绍了在Eclipse中使用项目存储运行配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NetBeans中进行编程,但是我也习惯使用Eclipse。我有一个Maven项目,我在NetBeans中开发的,并且在导入之后它在Eclipse中编译得很好。我正在使用NetBeans的运行或调试功能,并且很容易将运行配置存储在项目中,因此我可以将其提交到版本控制中,而其他的也可以使用它。说我有一个Java应用程序项目,它有一个主类。为了运行这个,我需要为exec目标定义正确的类路径(实际上NetBeans在创建新项目时会自动为我做这个)。



在Eclipse中,我必须定义运行配置,只要我知道存储在工作区中,而不是在项目中。在Eclipse中有什么类似的功能我正在寻找?

解决方案

是 - 打开运行,然后运行配置。 ..,然后选择您的配置。点击最后一个选项卡,常用。在另存为下,选择共享文件而不是本地文件。





此对话框有点混乱。 共享文件旁边的行只能是一个路径,而不是一个文件名 - 它默认为当前项目的根路径。一旦您点击应用,将在该文件夹中创建一个名为[运行配置名称] +.launch的文件。所以在上面的例子中,这样就产生了一个 /JavaTest/JavaTest.launch 文件。这是可以适应版本控制的。


I'm programming in NetBeans however i like to get used to Eclipse as well. I have a Maven project what i've developed in NetBeans and after importing it compiles fine in Eclipse. I'm using the Run or Debug feature of NetBeans a lot, and it's very comfortable that the run configuration gets stored with the project so i can actually commit it into version control and others can use it as well. Say i have a Java application project which has a main class. To run this, i need to define the correct class path for the exec goal (actually NetBeans automatically does this for me when creating the new project).

In Eclipse i have to define Run configurations which as far as i know gets stored in the workspace but not in the project. Is there any similar feature in Eclipse what i'm looking for?

解决方案

Yes - open "Run" then "Run Configurations...", and select your configuration. Click on the last tab, "Common". Under "Save As", choose "Shared File" instead of "Local File".

This dialog is a little confusing. The line next to "Shared File" can only be a path, not a file name - and it defaults to the root path of the current project. Once you hit "Apply", a file named the [Run Configuration Name] + ".launch" is created within that folder. So in my above example, this results in a "/JavaTest/JavaTest.launch" file. This is something that can be comitted to version control.

这篇关于在Eclipse中使用项目存储运行配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆