File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Building with ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Building with ant" Watch "Building with ant" New topic
Author

Building with ant

Dannie Kjeldgaard
Greenhorn

Joined: Oct 02, 2006
Posts: 7
Hello everybody!

I was wondering if it makes sence to build the application using an ant-script? If yes, does anyone have any good guidelines for it? I have used it before, but never wrote it myself.

Regards
Dannie
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288


I assume I am allowed post this as it is not a required part of the submission process. Here is the build file I have been working on. It compiles the java files in the code directory into the classes directory. It then runs javadoc and builds a runme.jar executable. Finally it jars all the directories and files (except the classes directory which is not needed because of runme.jar) into a submission jar called srXXXXXX.jar

Feel free to use and modify all,
Mark


SCJP<br />SCJD
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Just found this. Yes it's OK, but don't forget guys - Disclaimer: don't blame Mark or JR if this script does not do things the way that your assignment requires. Modify and use at your own risk.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
It's so small

But mine does more, like running unit tests.


42
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Jeroen T Wenting:
It's so small

But mine does more, like running unit tests.


Yeah I had junit tests in for a while until I was happy with the code (like I will ever be happy with it) :roll: . I Left them out of the sumbission build tho.

Agree with Barry verify that it does put everything in the submission jar correctly according to your spec and I agree even more strongly with the not blaming me bit too .

Bear in mind that all the userguide.txt, choices.txt should be in the correct folders (docs), version.txt and original bd file in the same directory as the build.xml which will be the jar root.

Mark.

[ December 11, 2006: Message edited by: Mark Smyth ]
[ December 11, 2006: Message edited by: Mark Smyth ]
Calle Sollander
Greenhorn

Joined: Dec 11, 2006
Posts: 3
Hello!
What about running 'rmic'?
Didn't your requirement state that:
You must provide all classes pre-installed so that no dynamic class downloading occurs.

That means that I can't rely on the new RMI feature "dynamic generation of stubs", or have I misunderstood?
I can add the ant task myself I'm just wondering if I need to do the 'rmic' compilation.
Regards, Calle
PS This is my first post here, and I want to thank everybody that answers questions it is really helpful!! I've found lots of good information by searching the forum.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
yup, that's something else he forgot in his antfile.
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Jeroen T Wenting:
yup, that's something else he forgot in his antfile.


Damn you Java 5!! There is a good chance I would have submitted the project without that stub .

Phew!! Cheers Guys
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Been thinking some more about this. Is it dynamically generating the stub on the fly really the same as dynamically downloading it though? After all the classes are already in the clients jar file so it does have access to all the class files it needs to generate the stubs from locally.

Shouldn't we take advantage a cool new feature of the Java 5 runtime environment?

Mark.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
the server may be able to generate the stub on the fly, but you still need to download it to the client if you choose that...
Luc Feys
Greenhorn

Joined: Nov 21, 2005
Posts: 20
Now I know why I scored 0 for the 'network server' section of my SCJD submission. I forgot to provide the stub.

I totally agree with Mark now: 'Damn you java 5'.

But at least I know now what the problem is. I feel relieved. Would have been really stupid if I would have failed because of that. Guess I'm a lucky bastard after all.
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Originally posted by Luc Feys:
Now I know why I scored 0 for the 'network server' section of my SCJD submission. I forgot to provide the stub.

I totally agree with Mark now: 'Damn you java 5'.

But at least I know now what the problem is. I feel relieved. Would have been really stupid if I would have failed because of that. Guess I'm a lucky bastard after all.


Guess I have my answer now!

Cheers all, I had a lucky escape here.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Originally posted by Jeroen T Wenting:
It's so small

But mine does more, like running unit tests.



I bet you can even type "ant make", Jeroen.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
I can type it, but it won't do much. There's no make target
Jan Heideken
Greenhorn

Joined: Dec 30, 2006
Posts: 10
Hy gyus. I'm strugglying through developer exam as well. As I got a lot of good ideas from here, I provide something from me. Here we go..

Missing rmi targets:

<target name="rmic" description="Run rmic to compile stubs and skeletons" depends="compile">
<rmic classname="suncertify.urlybird.rmi.URLYBIRDImpl" classpath="${classes.dir}" base="${classes.dir}" />
</target>

OK - this is not needed, but I like to do everything from ANT.

<target name="rmiregistry" description="Start up rmiregistry">
<echo message="Start up the rmi registry" />
<exec executable="rmiregistry">
<arg value="-J-classpath"/>
<arg value="-Jrunme.jar"/>
</exec>
</target>
[ January 08, 2007: Message edited by: Jan Heideken ]
Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
It seems that jdk 5 makes a trap. For this reason, I decide to get rid of all new features of 5.0 and first run under jdk4.x and later jdk 5.0.


SCJP 1.4 SCJD
Jason Hocker
Ranch Hand

Joined: Jul 23, 2003
Posts: 132
I cannot get this to work with javadoc. How do I set that up in ant with eclipse?
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi

Try Window->Show -> Ant and you get the ant view add here your ant file and you can see a list wit all your tasks. Just click on a task the magic is happen.

Regards M.


SCJP, SCJD, SCWCD, OCPJBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Building with ant