wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes ant build failed when using overload functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant build failed when using overload functions" Watch "ant build failed when using overload functions" New topic
Author

ant build failed when using overload functions

Ran Yuchtman
Greenhorn

Joined: Mar 27, 2011
Posts: 3
Hi All,

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,

Ran
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Ran,
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)


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

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.


JBoss In Action
Ran Yuchtman
Greenhorn

Joined: Mar 27, 2011
Posts: 3
Hi.

Thank you both for your help.

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)

Ran
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

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.
Ran Yuchtman
Greenhorn

Joined: Mar 27, 2011
Posts: 3
solved it.

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.

Thank you,
Ran
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Glad you found the solution!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ant build failed when using overload functions