Setting the classpath order in the playframework application

I have a project where I need to parse some HTML files as part of a game application. For this task, I decided to use nekohtml. I specify nekohtml as dep in the .yml and isse 'dependencies on the games. This inserts nekohtml and xerces into the lib folder. All is well and good. However, nekohtml must be before the xerces in the class path work correctly. And as far as I can see in https://github.com/playframework/play/blob/master/framework/pym/play/application.py#L124 , the ordering of the jars on the class path is arbitrary according to http: // docs. python.org/library/os.html#os.listdir Can I manually tune the order of cans on the classpath?

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 / mk / 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 ', ...

Thus, xerces is clearly ahead of nekohtml, even if the transitive dep is excluded and manually added after nekohtml.

+6
source share
1 answer

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

0
source

Source: https://habr.com/ru/post/891590/


All Articles