opencog/relex

Maven build fails on type mismatch double vs int.

wvxvw opened this issue · 7 comments

[ERROR] /home/wvxvw/projects/relex/relex/src/java/relex/RelationExtractor.java:[221,35] method setMaxCost in class org.linkgrammar.LGConfig cannot be applied to given types;
  required: int
  found: double
  reason: actual argument double cannot be converted to int by method invocation conversion

when trying to build the project with Maven (mvn install).

You have an outdated version of link-grammar. This bug was fixed in link-grammar version 5.1.1 back in september. You need that version or newer.

Yup, but Maven doesn't find it on its own. Ant build finds though. I didn't look into the pom.xml so I don't know where it picks the old one from.

oh. the pom file is wrong. It is hard-coding the link-grammar version, at line 404, which is wrong. Do you know how to make it not use a hard-coded version number? I have no clue how maven works.

I'm a casual user, at best, too. But off the top of my head, I'd say that one just needs to update the version of the artefact manually any time it needs updating (of course it may be scripted, but not something Maven would know to do on its own). When I'm back at the machine where I've built this, I'll look into Maven local repository to see how exactly it found linkgrammar.jar, and then will try to alter that such that it would point to my local sources of link-grammar.

Well, to be honest, I think that the way to deal with is just to update the <version>5.0.8</version> in the RelEx pom.xml to <version>5.2.3</version> or the version in between where LGConfig.setMaxCost accepted double. Anything else I can think of would require an involded manual setup on the side of the person trying to build using Maven.

Another way to go about it would be as suggested in the first answer in this Stackoverflow thread: http://stackoverflow.com/questions/30571/how-do-i-tell-maven-to-use-the-latest-version-of-a-dependency i.e. by setting it to the LATEST version (but then you would need to make sure that RelEx always builds with the latest version of link-grammar.)

Sorry, that's just plain dumb. Do you really think that the maintainer of link-grammar should find every maven project on planet earth, and then go update its pom.xml file? That's idiotic. Its not a workable, scalable solution.

Don't use Maven. Use common sense.

@linas I know that some times I can be slow and would insist on something nonsensical for far too long :) so I should be really careful, especially I'm not very confident about how exactly things work in Maven world, but I still think that the problem is not what you think it is and it's much more easily solved.

link-grammar programmers don't need to hunt down other programmers who used some version of their library. In this case RelEx programmers used new API from link-grammar, but forgot to mention it in the build file. This is something that happens quite a bit, especially with Maven, because of the bureaucracy inherent in the system and a painfully involved process of setting it up to work with the version not found on Nexus server (Maven word for code repository). But it's easy to fix once spotted: just update the dependency version.