Eclipse 添加您自己的构建命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2976610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:26:47  来源:igfitidea点击:

Eclipse adding your own build command

eclipse

提问by Viks

I am new to eclipse and wanted to do the following:

我是 eclipse 的新手,想执行以下操作:

  1. Use my custom build commands with eclipse. Until now I only saw make all. I use a shell script for building my project; how can I use that in an Eclipse environment?
  2. When I create a new project with the existing source code, it doesn't add the files, without building the code and if code fails to build (because I generally don't have make all).
  1. 在 Eclipse 中使用我的自定义构建命令。直到现在我才看到make all。我使用 shell 脚本来构建我的项目;如何在 Eclipse 环境中使用它?
  2. 当我使用现有源代码创建一个新项目时,它不会添加文件,也不会构建代码,并且如果代码无法构建(因为我通常没有make all)。

How do I resolve this issue?

我该如何解决这个问题?

采纳答案by fasseg

You can add a custom builder in the "Builders" category of the project properties.

您可以在项目属性的“构建器”类别中添加自定义构建器。

project->properties->builders->new

项目->属性->建造者->新建

there you can also deactivate the default eclipse builders..

在那里您还可以停用默认的 Eclipse 构建器..

hope that helped

希望有所帮助

回答by MKroehnert

In addition to what smeg4brains said and assuming that you are using the CDT plugin you can go to:

除了 smeg4brains 所说的并假设您正在使用 CDT 插件之外,您还可以访问:

project -> properties -> C/C++ Build

项目 -> 属性 -> C/C++ 构建

Uncheck Use default build commandon the Builder Settingstab and replace make with e.g. scons.

取消选中Use default build commandBuilder Settings选项卡并将 make 替换为 eg scons

On the Behaviourtab you can then specify the target to call for the Buildand Cleanphase.

Behaviour选项卡上,您可以指定要调用BuildClean阶段的目标。

To resolve your second issue open the Projectmenu and uncheck Build automatically. This will prevent Eclipse from building the project when it thinks it is necessary.

要解决您的第二个问题,请打开Project菜单并取消选中Build automatically。这将阻止 Eclipse 在它认为有必要时构建项目。

回答by Rupeshit

If you want to add other your own commands then the easiest way is to write Ant file for your project so by clicking once you can execute all your commands.To see how to write Ant file click here

如果您想添加其他您自己的命令,那么最简单的方法是为您的项目编写 Ant 文件,因此单击一次您可以执行所有命令。要查看如何编写 Ant 文件,请单击此处

回答by Dave Johansen

I was able to do something similar to have protoc run on my .proto files. I did it by adding a "Make Target" to the project.

我能够做一些类似于在我的 .proto 文件上运行 protoc 的事情。我通过向项目添加“Make Target”来做到这一点。