Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Canonical way to add junit.jar to classpath?
Canonical way to add junit.jar to classpath? [message #765328] Tue, 13 December 2011 21:05
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

By "canonical", I mean that in Eclipse we add JUnit testing to a project
via Build Path -> Configure Build Path -> Libraries -> Add Library ->
JUnit, etc.

You code your JUnit tests up in test as a Source Folder, right-click
them, choose Run or Debug and there you are, simple as can be.

This works perfectly until you throw ant into the mix.

Now, create build.xml in the project and code it up to do a build,
either from Eclipse's Ant view or outside from the command line.

Eclipse's JUnit-in-your-project approach doesn't put a copy of junit.jar
anywhere build.xml can easily get its hands on it. (Or, I just don't
know where that would be.)

Therefore, I'm obliged to accomplish this "non-canonically" by fetching
my own copy of junit.jar and putting somewhere in my project as if any
other third-party, Eclipse-unmanaged JAR. No problem, this is what I've
always done.

But I wanted to know if there is a "right" or "canonical" way to do this
that I just haven't discovered yet. (I always like to know the right way
to do a thing in order to give the right answer to people who ask
questions in forums.)

Secondarily, if there isn't a "right" way, then what might have been the
point to Eclipse handling JUnit for me in the first place?

Much thanks to anyone who comments and/or helps me here.

Russ
Previous Topic:Linking with "recreate folder structure" makes resource locations unresolvable
Next Topic:Launching projects
Goto Forum:
  


Current Time: Fri Apr 26 15:36:15 GMT 2024

Powered by FUDForum. Page generated in 0.08589 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top