building project using gant and eclipse - java

I am looking for a solution to build java project using gant inside eclipse, i searched web but didn't find any thing. May because I am not searching in the right direction because I have no idea about gant.
Actually I got all the java source and build.gant script from another developer, I made some minor changes in the java source only and since then looking for a way to build the solution without any luck.
I also tried to build solution using command line, downloaded binaries from ant and gant websites but for some reasons it's unable to find ANT_HOME variable, which I have already added as an environment variable.

Gant is a tool for scripting Ant tasks using Groovy instead of XML to specify the logic.
Download GANT from the Codehaus website and build using it.
http://gant.codehaus.org/

Related

Java beginnings using Netbeans

I'm just about starting to learn Java. Reading about, I installed Netbeans.
Running Apache Netbeans IDE 11.2.
The Java version is 13.0.2.
I'm promptly follow the Quickstart guide on the netbeans website.
File>>New project>> Java >> Java Application.
Errhmm, I don't have this 'Java' option. All I have is
So what's the difference between Java & Java with Maven/Cradle/Ant . At this point in time, I intend to start with basics of Java programming and then move on from there. SO which option am I meant to be starting with? If I'm missing Java, how can I add it ? Going through the installation procedures didn't give me any option to choose from.
p:s - this is all running on Mac OS Catalina
You can start with any of Java with ... option. I use Java with Ant option.
Maven, Gradle, Ant are build-tool addons i.e. they provide additional support if you intend to use any of these as your build tool.
When you choose Java with Ant option, it will let you create, compile, debug and run your Java programs without requiring anything additional. After using this option, you will get an interface as shown in the screenshot given below:
Maven, Gradle and Ant are build tool which allows you to compile, unit test, package and (if you like) even deploy your Java applications (they do support other languages btw).
I suggest you to start with one of those (Maven is very popular and probably a little bit easier than the others) instead of relying on your Java IDE specific features.
Once you master a build tool you can change IDE (IntelliJ is also a very good option ;-)) and will still work as before. You also find plenty of resources and help (like Stackoverflow) if you need hit some problems.
Best of luck!

What is the default build process used by IntelliJ for Java projects?

Building Java projects straight from the IDE in IntelliJ has been nice. It's fast and it just works. I wasn't able to find any documentation on how IntelliJ does these default builds. I'm guessing it uses Ant? What I want to do is automate this fast and painless build process for anyone who downloads my project. Is that possible?
I've usually used Maven, but it's very slow and error prone. I actually wasn't even able to convert this to a Maven project, because Maven refuses to find JUnit despite setting up the dependency according to examples in the official docs. I also tried to generate Ant build files from the IDE, but those do not work out of the box and after googling a bit, seems like that is not a good approach?
IntelliJ IDEA has its own build system, called JPS. It has limited support for automatic download of dependencies and it's really hard to invoke from the command line, so it's unlikely to be the best option for everyone who downloads your project, unless you want to force them to use IntelliJ IDEA.

How does one know what IDE was used for an open-source Java application?

I'm new to Java and Eclipse (C# developer here). I have a requirement to take an open-source Java application (OpenFire) and modify it to suit our needs.
I downloaded Eclipse Juno, I downloaded OpenFire. But something tells me that OpenFire was written using another IDE because when I try to open it in Eclipse, it complains about the element missing in the build.xml file (I used the "Open from an existing Ant BuildFile" option, which OpenFire has).
What can be the best way to approach this type of situation knowing that open-source can be written using so many tools out there? The goal is not to have to change much of the files just to get it into an IDE.
Any help or direction would help.
The IDE does not make a difference to the project unless there are IDE-specific artifacts like .classpath in the project tree. The build.xml file format is set by Ant, not by any one IDE, so it is extremely unlikely that the IDE is the source of your difficulty.
However, IDE-specific files have no place in the source repository.
Rather than chase down a red herring, look at the error in the build.xml and fix that.
Also, to diagnose if your IDE is mismanaging Ant, use ant from the command line to build your project. You should never depend on the IDE to build your project for you, and never use the IDE to build the project for someone else to use. Always use standard build tools like Ant or Maven or Gradle, and always run them from command line or script to get "official" builds.
If you can run your build that way, you are guaranteed independence of IDE irregularities.
What can be the best way to approach this type of situation knowing that open-source can be written using so many tools out there?
This problem has been already solved by IDE and platform independent build tools which are tightly integrated with most of the popular IDEs
Maven, Gradle are examples of such tools
These build tools also has standard configuration and directory structure which is understandable by popular IDEs

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

This is in regards to building a Java Project.
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
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)
After the build I need to run another command: ProGuard (http://proguard.sourceforge.net/)
run javadocs
Package everything up in Jar (also including external data, ie, images, xml, ini, etc)
Build/create a .jnlp web start.
Available under both Win and Linux would be optimal.
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).
btw, my IDE is Eclipse if it matters; 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. 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). I've only used it once, but seemed pretty quick to get going/working. Is that a good option for Java or this project? Any downsides to make? Why don't more java developer's use it?
Other options?
In a nutshell: spend your 12 hours learning and using 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.
To address some of your specific requirements:
you can use <compilerarg> elements with the <javac> task
for native libs you can add them with: <sysproperty> and key="java.library.path"
use Rhino with 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)
for javadoc Ant comes with the <javadoc> task out of the box
the <jar> Ant task is extremely easy to use to package everything up
there is a <jw:jnlpwar> task available from the [Ant Web Start Task project] at (http://ant-jnlp-war.sourceforge.net)
Ant is ubiquitous, it works for just about every major platform out there (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.
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)
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.
I should probably just mention the 2 new names in Java build (and CI) tools: Hudson and Jenkins. 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)
Maven is the best choice here as it has integration for all of these
so go for it.
Here, quick links for you to save an extra hour to spend on learning maven ;)
Maven Compiler Options
Native Maven Plugin and Projects with JNI
Use Maven Antrun Plugin to Run rhino compile ant task
Use Proguard Maven Plugin (further details)
Maven Javadocs Plugin
Maven Assembly Plugin
Webstart Maven Plugin
Its java based so supported by most OS that support java !
It depends how quickly one can learn but AFAIK 12 hrs is sufficient to get started

How to run cuke4duke through jruby in intellij

I want to run cucumber in my java project directly through jruby without having to use Ant or Maven. I have installed cuke4duke through jruby and have it up and running. I can run the feature files but I have problem in getting my step definition recognized by cucumber. Although I have the step definition folder, implementations are shown as pending to me.
What can I do to resolve this.
It's not supported yet, feel free to vote for this feature request.

Categories

Resources