2011-09-07 178 views
0

從Play 1.2.1升級到1.2.3時,出現一些編譯錯誤。例如:WsAsync.newRequest現在需要兩個參數而不是一個參數。向後兼容性play-1.2.3

玩1.2.3有兩個玩罐子:Play.jar和play-1.2.3.jar。 Play.jar似乎有newRequest的早期版本,並且如果兩個jar都添加到eclipse中的構建路徑中,則不存在編譯錯誤。但是當我運行播放它似乎只使用play-1.2.3.jar。我甚至試圖將play.jar複製到應用程序庫目錄中而不解決問題。

有人可以告訴我如何使用兩個玩罐來獲得向後兼容性嗎?

Neneath從play classpath輸出:

[email protected]:/disk2/dba/lib$ /disk2/play-1.2.3/play classpath --%test-hh 
~  _   _ 
~ _ __ | | __ _ _ _| | 
~ | '_ \| |/ _' | || |_| 
~ | __/|_|\____|\__ (_) 
~ |_|   |__/ 
~ 
~ play! 1.2.3, http://www.playframework.org 
~ framework ID is test-hh 
~ 
~ Computed classpath is: 
~ 
['/disk2/dba/lib/conf', '/disk2/play-1.2.3/framework/play-1.2.3.jar', '/disk2/play-1.2.3/modules/testrunner/lib/play-testrunner.jar', '/disk2/play-1.2.3/framework/lib/hibernate-core-3.6.1.Final.jar', '/disk2/play-1.2.3/framework/lib/activation-1.1.1.jar', '/disk2/play-1.2.3/framework/lib/commons-beanutils-1.8.3.jar', '/disk2/play-1.2.3/framework/lib/javassist-3.9.0.GA.jar', '/disk2/play-1.2.3/framework/lib/jj-simplecaptcha.jar', '/disk2/play-1.2.3/framework/lib/javax.inject-1.0.jar', '/disk2/play-1.2.3/framework/lib/hibernate-jpa-2.0-api-1.0.0.Final.jar', '/disk2/play-1.2.3/framework/lib/commons-email-1.2.jar', '/disk2/play-1.2.3/framework/lib/groovy-all-1.7.7.jar', '/disk2/play-1.2.3/framework/lib/jj-wikitext.jar', '/disk2/play-1.2.3/framework/lib/log4j-1.2.15.jar', '/disk2/play-1.2.3/framework/lib/jj-textile.jar', '/disk2/play-1.2.3/framework/lib/dom4j-1.6.1.jar', '/disk2/play-1.2.3/framework/lib/ehcache-core-2.0.0.jar', '/disk2/play-1.2.3/framework/lib/ivy-2.2.0.jar', '/disk2/play-1.2.3/framework/lib/signpost-core-1.2.jar', '/disk2/play-1.2.3/framework/lib/commons-collections-3.2.1.jar', '/disk2/play-1.2.3/framework/lib/slf4j-log4j12-1.6.1.jar', '/disk2/play-1.2.3/framework/lib/jamon-2.7.jar', '/disk2/play-1.2.3/framework/lib/postgresql-9.0.jar', '/disk2/play-1.2.3/framework/lib/antlr-2.7.6.jar', '/disk2/play-1.2.3/framework/lib/asm-all-3.3.1.jar', '/disk2/play-1.2.3/framework/lib/mysql-connector-java-5.1.13.jar', '/disk2/play-1.2.3/framework/lib/jj-imaging.jar', '/disk2/play-1.2.3/framework/lib/xstream-1.3.jar', '/disk2/play-1.2.3/framework/lib/commons-logging-1.1.1.jar', '/disk2/play-1.2.3/framework/lib/joda-time-1.6.jar', '/disk2/play-1.2.3/framework/lib/snakeyaml-1.7.jar', '/disk2/play-1.2.3/framework/lib/commons-lang-2.6.jar', '/disk2/play-1.2.3/framework/lib/ezmorph-1.0.3.jar', '/disk2/play-1.2.3/framework/lib/cglib-nodep-2.2.jar', '/disk2/play-1.2.3/framework/lib/hibernate-commons-annotations-3.2.0.Final.jar', '/disk2/play-1.2.3/framework/lib/jta-1.1.jar', '/disk2/play-1.2.3/framework/lib/org.eclipse.jdt.core-3.6.0.jar', '/disk2/play-1.2.3/framework/lib/geronimo-servlet_2.5_spec-1.2.jar', '/disk2/play-1.2.3/framework/lib/jaxen-1.1.jar', '/disk2/play-1.2.3/framework/lib/junit-4.8.1.jar', '/disk2/play-1.2.3/framework/lib/oval-1.50.jar', '/disk2/play-1.2.3/framework/lib/jregex-1.2_01.jar', '/disk2/play-1.2.3/framework/lib/slf4j-api-1.6.1.jar', '/disk2/play-1.2.3/framework/lib/bcprov-jdk15-1.45.jar', '/disk2/play-1.2.3/framework/lib/commons-fileupload-1.2.2.jar', '/disk2/play-1.2.3/framework/lib/c3p0-0.9.1.2.jar', '/disk2/play-1.2.3/framework/lib/jsr107cache-1.0.jar', '/disk2/play-1.2.3/framework/lib/commons-io-2.0.1.jar', '/disk2/play-1.2.3/framework/lib/mail-1.4.3.jar', '/disk2/play-1.2.3/framework/lib/commons-javaflow-1066591.jar', '/disk2/play-1.2.3/framework/lib/hibernate-entitymanager-3.6.0.Final.jar', '/disk2/play-1.2.3/framework/lib/memcached-2.6.jar', '/disk2/play-1.2.3/framework/lib/commons-codec-1.4.jar', '/disk2/play-1.2.3/framework/lib/netty-3.2.4.Final.jar', '/disk2/play-1.2.3/framework/lib/h2-1.3.149.jar', '/disk2/play-1.2.3/framework/lib/gson-1.7.1.jar', '/disk2/play-1.2.3/framework/lib/async-http-client-1.6.3.jar'] 

回答

0

我不得不發揮-1.2.3 /框架目錄下造成兩種不同的打法jar文件的問題。

我比較了play.jar和play-1.2.3.jar中的文件「play/version」。對於play.jar,版本文件內容爲「1.1.2」,對於play-1.2.3.jar則爲「1.2.3」。我的結論是,play.jar是該框架的舊版本,並且被錯誤地包含在軟件包中,所以我通過從play-1.2.3/framework目錄中刪除play.jar來解決這個問題。

對於具體的不兼容問題,我建議你只是改變你的代碼。 WsAsync.newRequest已在Play 1.2.2中更改爲

public WSRequest newRequest(String url, String encoding)