6
votes

I have a project where I need to parse some HTML files as part of a play application. For that task, I thought I'd apply nekohtml. I specify nekohtml as a dep in dependencies.yml and isse 'play dependencies'. This pulls in nekohtml and xerces into the lib folder. All well and good. However, nekohtml needs to be before xerces on the classpath to work properly. And as far as I can see at https://github.com/playframework/play/blob/master/framework/pym/play/application.py#L124 the ordering of jars on the classpath is arbitrary as per http://docs.python.org/library/os.html#os.listdir Is it possible to manually set the ordering of jars on the classpath somehow?

Edit: My dependencies.yml looks like this:

require:  
  - play
  - org.apache.poi -> poi 3.7
  - net.sourceforge.nekohtml -> nekohtml 1.9.14:
       transitive: false
  - xerces -> xercesImpl 2.9.1

When I issue the command 'play classpath' it lists the following (excerpt):

['/home/leif/dev/java/fun/tk/conf', '/home/leif/dev/play/play-1.2/framework/play-1.2.jar', '/home/leif/dev/java/fun/tk/lib/jaxen-1.1.jar', '/home/leif/dev/java/fun/tk/lib/log4j-1.2.15.jar', '/home/leif/dev/java/fun/tk/lib/junit-4.8.1.jar', '/home/leif/dev/java/fun/tk/lib/jta-1.1.jar', '/home/leif/dev/java/fun/tk/lib/dom4j-1.6.1.jar', '/home/leif/dev/java/fun/tk/lib/xercesImpl-2.9.1.jar', '/home/leif/dev/java/fun/tk/lib/commons-collections-3.2.1.jar', '/home/leif/dev/java/fun/tk/lib/xml-resolver-1.2.jar', '/home/leif/dev/java/fun/tk/lib/xml-apis-1.3.04.jar', '/home/leif/dev/java/fun/tk/lib/antlr-2.7.6.jar', '/home/leif/dev/java/fun/tk/lib/poi-3.7.jar', '/home/leif/dev/java/fun/tk/lib/commons-logging-1.1.1.jar', '/home/leif/dev/java/fun/tk/lib/nekohtml-1.9.14.jar', '/home/leif/dev/play/play-1.2/framework/lib/jj-textile.jar', ...

So xerces is clearly ahead of nekohtml even though the transitive dep is excluded and added manually after nekohtml.

1
I am having a similar problem. Can anyone point out how to manually specify build order for two jar in /lib?Wint

1 Answers

0
votes

Why don't you exclude xerces from the nekohtml dependency and then manually add it in the order you need as a separate dependency?