Wayne Fay wrote:
> 
> This is a fun "bug" that we see on this list a couple times a year.
> 
> It happens when you've got the javax.servlet.* source files in one of
> your dependency jars. Its not a Maven error -- this is simply the
> behavior of the java compiler. I'm pretty sure you're using GWT
> (gwt-user-x.y.z.jar) as a dependency in your project, right?
> 
> There are a couple other threads in the last 2 years on this list
> talking about this problem in more detail. It doesn't happen often,
> but the fix is always to remove the source files from the jars, you
> may need to repack those jars and deploy them to your Corporate MRM
> (perhaps with a modified version) to avoid this in the future.
> 

You're exactly right. We do use GWT, and removing gwt-user-1.7.0 fixes the
problem. I found related issues on the GWT bug tracker in case someone else
comes across this post:
http://code.google.com/p/google-web-toolkit/issues/detail?id=3439
http://code.google.com/p/google-web-toolkit/issues/detail?id=3851

A brief explanation of why it happens: per the 
http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html javac
tool docs , javac searches the whole classpath for source files to compile
unless the -sourcepath option is given. By default, if a source file has a
newer timestamp than a class file, the source file is compiled. In my
dependency list, i had the servlet-api jar listed before the gwt-user jar,
and the classes in the former are older than the source files in the latter.
That's why removing the servlet-api jar fixed the problem: there are class
files in the gwt jar with a timestamp equal to or newer than the source
files. Given that everything compiles fine without the servlet-api, I think
I can just leave it out. Problem solved.

Due to the above, if the compiler plugin were able to set a sourcepath, it
should prevent javac from scanning the classpath for source files.
Unfortunately, there doesn't seem to be an option for this in the plugin at
this time.

Thanks so much for the prompt and accurate response! This issue was
maddening.
-- 
View this message in context: 
http://old.nabble.com/Maven-compile-puts-javax.servlet.*-in-target-classes-tp27135933p27145465.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to