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

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

问题描述

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



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



如果没有办法通过命令行编译Eclipse项目,有没有办法从Eclipse中生成所需的java命令行?还是有一些文件我可以po to to to地找到在幕后的编译步骤?有人,我正在寻找一个答案,而不是包括蚂蚁。






让我重复一遍原来的问题.......有没有办法从命令行构建Eclipse项目?



我不认为这个这是一个不合理的问题,因为我可以为视觉工作室做这样的事情:

  devenv.exe / buildDebug |任何CPU C:\Projects\MyProject\source\MyProject.sln


解决方案

您可以通过命令行的工作区构建一个eclipse项目:

  eclipsec.exe  - noSplash -dataD:\Source\MyProject\workspace-application org.eclipse.jdt.apt.core.aptBuild 

它使用 jdt apt 插件来自动构建工作空间。这也被称为无头建筑。很难弄清楚。如果您没有使用win32 exe,可以尝试以下方式:

  java -cp startup.jar -noSplash -data D:\Source\MyProject\workspace-application org.eclipse.jdt.apt.core.aptBuild 

更新



几年前,eclipse替换了 startup.jar equinox launcher



https://wiki.eclipse .org / Equinox_Launcher



在Eclipse Mars(MacOX)上:

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

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



等分启动器的版本号将取决于您所使用的eclipse版本。 p>

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

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.

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?


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?

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:\Projects\MyProject\source\MyProject.sln"

解决方案

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

eclipsec.exe -noSplash -data "D:\Source\MyProject\workspace" -application org.eclipse.jdt.apt.core.aptBuild

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:\Source\MyProject\workspace" -application org.eclipse.jdt.apt.core.aptBuild

Update

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

https://wiki.eclipse.org/Equinox_Launcher

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

The -data parameter specifies the location of your workspace.

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

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

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