简体   繁体   English

Java Build; 满足这些要求,什么是不错的选择?

[英]Java Build; with these requirements, what would be a good choice?

This is in regards to building a Java Project. 这与构建Java项目有关。

So I'm a bit confused on my options here. 所以我对这里的选择有些困惑。

My requirements (it's a small project): 我的要求(这是一个小项目):

  • Needs to compile Java project with specific/custom compiler arguments 需要使用特定/自定义编译器参数来编译Java项目

  • Project has native libs that need to be included 项目具有需要包含的本机库

  • need to compile javascript->java class via Rhino javascript compiler (https://developer.mozilla.org/en/Rhino/JavaScript_Compiler) 需要通过Rhino javascript编译器(https://developer.mozilla.org/en/Rhino/JavaScript_Compiler)编译javascript-> java类

  • After the build I need to run another command: ProGuard (http://proguard.sourceforge.net/) 构建后,我需要运行另一个命令:ProGuard(http://proguard.sourceforge.net/)

  • run javadocs 运行javadocs

  • Package everything up in Jar (also including external data, ie, images, xml, ini, etc) 将所有内容打包到Jar中(还包括外部数据,例如图像,xml,ini等)

  • Build/create a .jnlp web start. 生成/创建一个.jnlp网络启动。

  • Available under both Win and Linux would be optimal. 在Win和Linux下都可用是最佳选择。

  • this is a hobby project, so don't want to spend weeks learning/managing the build system. 这是一个业余项目,所以不想花数周的时间来学习/管理构建系统。 At most an 8-12 hour investment start to finish (otherwise it's just better to keep doing everything by hand). 最多只需要8到12个小时就可以完成投资(否则最好继续手工做所有事情)。

  • btw, my IDE is Eclipse if it matters; 顺便说一句,如果重要的话,我的IDE是Eclipse; a nice integrated plugin would be nice - but not required. 一个不错的集成插件会不错-但不是必需的。

So far I think Ant and Maven are the main two build systems in use. 到目前为止,我认为Ant和Maven是使用中的两个主要构建系统。 It's very unclear to me though which one I should use or how they differ? 我不清楚我应该使用哪一个,或者它们之间有何不同?

The other option would be 'make' under linux (or maybe cygwin). 另一个选项是在Linux(或可能是cygwin)下的“ make”。 I've only used it once, but seemed pretty quick to get going/working. 我只使用过一次,但看起来很快就可以开始工作。 Is that a good option for Java or this project? 对于Java或该项目,这是一个不错的选择吗? Any downsides to make? 有什么缺点吗? Why don't more java developer's use it? 为什么不更多的Java开发人员使用它?

Other options? 还有其他选择吗?

In a nutshell: spend your 12 hours learning and using Ant. 简而言之:花12个小时学习和使用Ant。

Maven has a good feel out-of-the box, super-easy to get going and with the neat dependency management, but down the line tweaking the pom.xml (your project's maven build file) to fit your needs will require more fiddling with than if you used Ant. Maven具有开箱即用的良好感觉,使用整洁的依赖项管理非常容易上手,但是根据需要调整线pom.xml(项目的maven构建文件)以适应您的需求将需要更多的摆弄。比起您使用Ant而言。

To address some of your specific requirements: 要满足您的一些特定要求:

  • you can use <compilerarg> elements with the <javac> task 您可以将<compilerarg>元素与<javac>任务一起使用
  • for native libs you can add them with: <sysproperty> and key="java.library.path" 对于本机库,可以使用以下命令添加它们: <sysproperty>key="java.library.path"
  • use Rhino with Ant (http://stackoverflow.com/questions/3526960/using-recent-rhino-in-ant-script) 将Rhino与Ant搭配使用(http://stackoverflow.com/questions/3526960/using-recent-rhino-in-ant-script)
  • there is a Proguard task for Ant (http://proguard.sourceforge.net/index.html#/manual/ant.html) 蚂蚁有一个Proguard任务(http://proguard.sourceforge.net/index.html#/manual/ant.html)
  • for javadoc Ant comes with the <javadoc> task out of the box for Javadoc Ant附带了<javadoc>任务
  • the <jar> Ant task is extremely easy to use to package everything up <jar> Ant任务非常易于使用,可以打包所有内容
  • there is a <jw:jnlpwar> task available from the [Ant Web Start Task project] at (http://ant-jnlp-war.sourceforge.net) [Ant Web Start Task project]中有一个<jw:jnlpwar>任务,网址为(http://ant-jnlp-war.sourceforge.net)
  • Ant is ubiquitous, it works for just about every major platform out there (Linux, Unix, Windows, MacOS) Ant无处不在,它适用于几乎所有主要平台(Linux,Unix,Windows,MacOS)
  • with plenty of docs and examples available on the web, you'll pick-up Ant in no time, and those hours you'll spend learning it will probably "pay" themselves back within a couple of weeks of using it for your builds. 网上有大量的文档和示例,您可以立即使用Ant,而您花在学习它上的那些时间很可能会在将其用于构建时的几周内“收回”自己的钱。
  • Eclipse integrates with Ant out of the box (http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-81_basics.htm) Eclipse与现成的Ant集成(http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-81_basics.htm)

It may not do fancy dependency management out-of-the-box like Maven (although for that you can integrate Ant with Ivy) but it certainly provides you with all the flexibility you'll ever need, and you won't find yourself "fighting" the build tool configuration file as it's fairly common with Maven. 它可能不会像Maven那样开箱即用地进行依赖管理(尽管您可以将Ant与Ivy集成在一起),但是它无疑为您提供了所需的所有灵活性,而且您不会发现自己“与“构建工具配置文件”相对应,因为它在Maven中相当普遍。

I should probably just mention the 2 new names in Java build (and CI) tools: Hudson and Jenkins . 我可能应该只提到Java构建(和CI)工具中的两个新名称: HudsonJenkins They're fairly recent and may be interesting to look at, but I would definitely not recommend them to you and your project at this early stage. 它们是相当新的,可能看起来很有趣,但是我绝对不会在早期阶段将它们推荐给您和您的项目。

Note: apologies for the lack of real links (only allowed 2 links atm) 注意:缺少实际链接的道歉(仅允许2个链接atm)

Maven is the best choice here as it has integration for all of these Maven是这里的最佳选择,因为它集成了所有这些功能

so go for it . 所以去吧

Here, quick links for you to save an extra hour to spend on learning maven ;) 在这里,快速链接可为您节省额外的时间来学习Maven;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 什么语言可以替代Java? - What languages would be a good replacement for Java? 什么Java数据结构/解决方案最适合这些要求? - What Java Data Structure/Solution would best fit these requirements? 什么是找到图像移位的好算法(Java) - What would be a good algorithm to find image shifts (Java) Java 8中Spliterator的一个很好的用例场景是什么? - What would be a good use-case scenario for the Spliterator in Java 8? 什么是初学者Java网络程序的好测试方案 - What would be a good test regimen for beginner java network program 什么样的创作设计模式适合这些要求? - What creational design pattern would suit these requirements? 基于视频的应用程序的Java:不错的选择? - Java for a video based application: Good choice? GWT的Java数据库抽象(或:Hibernate是一个不错的选择吗?) - Java database abstraction for GWT (or: Is Hibernate a good choice?) Java是流服务器应用程序的不错选择吗? - Is Java a good choice for a streaming server application? 用于在Java中初始化散列映射的良好设计模式选择 - Good design pattern choice for initializing a hashmap in Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM