0

我正在创建一个系统来编译第一年和第二年的 Java 程序,目前我正在编译单个 Java 文件。

当我开始尝试让系统编译具有多个类的项目时,我认为作为一年级和二年级的学生,他们不会以相同的格式提交所有项目。

我昨天一直在尝试研究这一切,但找不到很多关于以下内容的信息:

  • 编译时 Netbeans 和 Eclipse 项目之间的主要区别是什么
  • 如何在jar文件中编译项目
  • 一般只是不同的格式

所以我的问题是,是否有编译器可以编译所有不同的格式,或者您是否必须将不同的格式设置为某种方式来编译它们?

这也有什么例子吗?

4

2 回答 2

0

要求使用 Maven 构建(是的,它有它的缺点,但至少你会得到一致性)。

于 2012-06-06T17:02:59.460 回答
0

What I understand is you want something that can compile all types of Java projects (NetBeans, Eclipse, etc.)

Sorry to say this but there isn't one that can compile all the formats out there. But you could write your own, for at least the most common types of formats that you receive from the students.

Check out this page for more information: Building Java Projects.

What I suggest is, start by studying the build architecture used by those tools (NetBeans, Eclipse, etc.) and come up with a build script of your own that can extract the class paths of all the classes in the java project. Let your script do the work for you!

If you don't wish to write your own scripts, then you may consider changing the projects you receive into a standard project format. Check out this and this link to see more about migrating from Ant to Maven or Maven to Ant.

Else, you can always manually port your existing projects into other IDE, provided they follow the same build mechanism. Check out this answer to know more.

于 2016-08-16T18:57:06.747 回答