I have a build script that builds our company deployment which contains about 20 projects.
while compiling one of the projects which is using an other entities project, the build is failed.
the thing is that in the entities project there are some overloaded functions and constructors and it seems that when the failing project is trying to compile it sees only the "simple" functions and constructors of the entities project and not the ones which gets parameters.
the weirdest thing is that this is only happens in this project. other projects that uses the entities project are compiling just fine.
I'm trying to solve it for days, and couldn't find any solution online.
tried in linux and windows, but build steel fails.
Thank you for any help and advice you could give me,
To be sure I understand, the error is compile on not finding methods that are clearly there, right? Sharing the specific error might help in case it is failing on something similar but different.
Are you using the same version of Java in the working and non-working projects? Can you reproduce the problem in a simple example you can share here? (The act of simplifying the problem often finds a clue as well)
Posting the build script output would also help. And tell us which build tool you use (Ant, Maven, etc.)
And another thought - you don't have a hidden JAR file somewhere that has an older version of the classes being compiled? I ask because this happened to me, the build for some other project placed an older version of a JAR that I also used into the "endorsed" directory. My build failed saying that a certain method signature did not exist, but when I looked at the source of the method that signature was there. I finally found the errant JAR file by adding -verbose:class to the compiler's command line options. This option causes the JVM to print out each class it loads, and the JAR from which it loads it. Once I located the errant JAR file I have a few choice words for the team that placed the JAR in the endorsed directory (they were too lazy to figure out how create a classpath for their build so they just placed all the JARs they needed into endorsed!) I recommend to the build team that they lock down the entire JVM directory to prevent such mishaps in the future.
the compile error is "could not find symbol".
here is the output:
I'm using Ant for this build and i cannot reproduce the problem to a simple problem because it only happens in one project. in all other projects that are using the same functions and constructor everything is OK.
I'm not sure how to check if all projects are using the same Java, but I'm guessing they are because everything is under the same environment.
I'll look for hidden old Jar with verbose (but once again, I'm guessing it's not that because other projects succeed)
I think we can rule out the version of Java because the String constructor shows it's not an auto-boxing error.
You can still reproduce the error within this project. Create a new class that calls the code that isn't compiling and remove your other code from the project. Then just point to the one jar needed to compile. If this works, add jars back until the error shows up.
Peter's stray jar theory sounds very likely.
Joined: Mar 27, 2011
Thank you very much for your help.
i ran the build with verbose and found the problem source.
one of the projects demand a copy of some our jars to the dist directory. there were some not updated jars there that caused the problem.