我正在尝试使用 svnkit 将文件添加到我的存储库,但我得到一个 NoSuchMethodError 引用这行代码:
SVNDiffWindow diffWindow = SVNDiffWindowBuilder.createReplacementDiffWindow(deltaLength);
这是堆栈跟踪:
java.lang.NoSuchMethodError: org.tmatesoft.svn.core.io.diff.SVNDiffInstruction.<init>(IJJ)V
at org.tmatesoft.svn.core.io.diff.SVNDiffWindowBuilder.createReplacementDiffWindow(SVNDiffWindowBuilder.java:529)
at adc.ui.util.SvnTest.testSvnCommit(SvnTest.java:109)
这是所有代码:
File file = new File( "c:/development/photolib/discounts/svnTesting/testThisTextCommit1.txt" );
try {
DAVRepositoryFactory.setup();
String url = "https://subversion.access.dev/svn/sticks/media/trunk/Discounts/PhotoLib/svnTesting";
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
ISVNEditor editor = repository.getCommitEditor("This is a log message.", new CommitMediator());
editor.openRoot(-1);
editor.addFile("testThisTextCommit1.txt", null, -1);
editor.applyTextDelta("testThisTextCommit1.txt", null);
long deltaLength = file.length();
SVNDiffWindow diffWindow = SVNDiffWindowBuilder.createReplacementDiffWindow(deltaLength);
OutputStream os = editor.textDeltaChunk("testThisTextCommit1.txt", diffWindow);
os.close();
editor.textDeltaEnd("testThisTextCommit1.txt");
editor.closeFile("testThisTextCommit1.txt", null);
editor.closeEdit();
}
会不会是我使用的是过时的版本?这是我正在使用的依赖项:
<pluginRepository>
<id>org.tmatesoft.svnkit</id>
<name>tmatesoft.svnkit svnkit Repository</name>
<url>http://maven.svnkit.com/maven2/</url>
</pluginRepository>