从命令行构建 Eclipse Java 项目 [英] Build Eclipse Java Project from Command Line

查看:44
本文介绍了从命令行构建 Eclipse Java 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从命令行编译基于 Eclipse 的 Java 项目?

Is there a way to compile an Eclipse-based Java project from the command line?

我正在尝试自动化我的构建(使用 FinalBuilder 而不是 ant),我既不是 Java 也不是 Eclipse 专家.我可能可以弄清楚如何使用直接的 java 命令行选项来做到这一点,但是 Eclipse 项目感觉就像是浪费了很多精力.

I'm trying to automate my build (using FinalBuilder not ant), and I'm neither a Java nor Eclipse expert. I can probably figure out how to do this with straight java command line options, but then the Eclipse project feels like a lot of wasted effort.

如果无法通过命令行编译 Eclipse 项目,有没有办法从 Eclipse 中生成所需的 java 命令行?或者是否有一些文件我可以四处查看以找到它在幕后执行的编译步骤?

In the event that there is no way to compile an Eclipse project via the command line, is there a way to generate the required java command line from within Eclipse? Or are there some files I can poke around to find the compile steps it is doing behind the scenes?

伙计们,我正在寻找一个包括蚂蚁的答案.让我再重复一下原来的问题....... 有没有办法从命令行构建一个Eclipse项目?

Guys, I'm looking for an answer that does NOT include ant. Let me re-iterate the original question ....... Is there a way to build an Eclipse project from the command line?

我不认为这是一个不合理的问题,因为我可以为 Visual Studio 做这样的事情:

I don't think this is an unreasonable question given that I can do something like this for visual studio:

devenv.exe /build "Debug|Any CPU" "C:ProjectsMyProjectsourceMyProject.sln"

推荐答案

您可以从命令行通过工作区构建 Eclipse 项目:

You can build an eclipse project via a workspace from the command line:

eclipsec.exe -noSplash -data "D:SourceMyProjectworkspace" -application org.eclipse.jdt.apt.core.aptBuild

它使用 jdt apt 插件自动构建您的工作区.这也称为无头构建".该死的很难弄清楚.如果你没有使用 win32 exe,你可以试试这个:

It uses the jdt apt plugin to build your workspace automatically. This is also known as a 'Headless Build'. Damn hard to figure out. If you're not using a win32 exe, you can try this:

java -cp startup.jar -noSplash -data "D:SourceMyProjectworkspace" -application org.eclipse.jdt.apt.core.aptBuild

更新

几年前 eclipse 用equinox 启动器"替换了 startup.jar

Several years ago eclipse replaced startup.jar with the "equinox launcher"

https://wiki.eclipse.org/Equinox_Launcher

在 Eclipse Mars (MacOX) 上:

On Eclipse Mars (MacOX):

java -jar /Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar -noSplash -data "workspace" -application org.eclipse.jdt.apt.core.aptBuild

-data 参数指定工作区的位置.

The -data parameter specifies the location of your workspace.

Equinox 启动器的版本号将取决于您拥有的 eclipse 版本.

The version number for the equinox launcher will depend on what version of eclipse you have.

这篇关于从命令行构建 Eclipse Java 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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