apache - Eclipse and How it Handles JARS -- Odd Case -


trying make small changes apache's velocity engine.

here's can , can't do.

i'm making change merge function(). change i'm making doesn't matter because haven't made yet. ;) right settling println statement firing.

i have 2 references merge(). if change function mergebad() eclipse tells me can't find merge(). makes sense right? used include in class build path 2 jars when downloading velocity instead i've created project using src files provided , used project dependency. again, fact can't find merge() when rename mergebad gives me hope.

but when running web server, hit breakpoint , step merge call, can't find source! point project yet again, , "finds" source, none of changes i've made (specifically println statements) hit. skipped over. :(

what on god's green earth possibly causing this? it's driving me insane. i've spent entire day today trying figure out what's wrong. can't continue without being able change velocity. code base eclipse running velocity files from?

many in advance so! :)

this typical case of confusion between build classpath , runtime classpath.

your build classpath contains references java project (containing changes velocity)... bet runtime classpath holds references original velocity jar files.

managing build classpath , runtime classpath in web projects under eclipse (the wtp - web tools project) has been going through massive changes on last few wtp releases. can guide through. if physically added velocity's jar files web-inf/lib, lets start removing them.


ok, after remove velocity.jar file web-inf/lib, following:

  1. right-click project, select "properties".
  2. go "java build path". select "projects" tab , make sure custom velocity project (lets call "myvelocity") not there.
  3. still in "java build path", select "libraries" tab , make sure no velocity jar there either.

by following steps above, cleaned web-app reference whatsoever myvelocity (your project) or other velocity jar.

now comes fun part. instruct how correctly "add" java projects web projects dependencies.

  1. still in project's properties, go deployment assembly.
  2. click "add".
  3. select "project" , "next".
  4. select "myvelocity" , make sure "web library reference" checkbox checked.
  5. click "finish".

back in deployment assembly dialog, should see myvelocity mapped web-inf/lib/myvelocity.jar.

click ok.

what did map myvelocity web-inf/lib dependency. doing that, myvelocity automatically added compile-time build-path - very important don't add build-path, resulting in duplicate build-path entries.

everything should work now. let me know if have problems.

p.s. these instructions correct if you're developing stand-alone war project; if war file part of ear, may wish (under circumstances, example if myvelocity used other j2ee modules inside ear) map myvelocity differently, common location; if that's case, let me know , i'll elaborate further.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -