Hi,
I'm trying to use ivysvn.
I think the idea of an ivy svn resolver is great. However I'm having
trouble publishing...
First of all my resolver configuration:
<property name="common.ivy.pattern" value="CommonModules/[module]/
releases/[revision]/ivy.xml" />
<property name="common.artifact.pattern" value="CommonModules/
[module]/releases/[revision]/[usage]/[artifact].[ext]" />
<svn name="myivysvn"
userName="******"
userPassword="******"
repositoryRoot="
https://sub.domain.com/svn/reporoot/"
binaryDiff="false"
>
<ivy pattern="${common.ivy.pattern}"/>
<artifact pattern="${common.artifact.pattern}" />
</svn>
I looked a bit around the sources and it seems like something weird is
happening, because the sequence basically is:
* I first published an original revision (all ok)
* I want to republish the same files using:
<ivy:publish
artifactspattern="${bin.dir}/[usage]/[artifact].[ext]"
srcivypattern="${bin.dir}/ivy.xml"
resolver="myivysvn"
overwrite="true"
status="release"
/>
note: [usage] refers to an "extra" attribute which happens to be "" on
this build, however I don't think that's part of the problem
The files I'm publishing are according to this ivy file:
<ivy-module version="2.0" xmlns:e="
http://ant.apache.org/ivy/extra">
<info organisation="PayTrue" module="ISO8583" revision="ivytest" /
>
<publications>
<artifact name="PayTrue.PayStudio.Common.ISO8583" type="dll"
e:usage=""/>
<artifact name="PayTrue.PayStudio.Common.ISO8583" type="pdb"
e:usage=""/>
</publications>
</ivy-module>
So 7 files are published (ivy file, dll + sha1 + md5, pdb + sha1 +
md5)
* ivysvn goes on to publish the first dll, I see in SvnDao it uses
putFile which first checks whether fileExists, then does an update or
add depending on that (update only if overwrite is true, which it is).
The file does exist, so it updates it, all ok.
* ivysvn then goes on to publish the sha1 file, in SvnDao it checks
fileExists which returns "false", then does an "add" which of course
fails because the file does exist.
Just to check things out I recompiled that file with some printouts as
this:
public boolean putFile(ISVNEditor editor, byte[] data, String
destinationFolder, String fileName, boolean overwrite)
throws SVNException {
String filePath = destinationFolder + "/" + fileName;
System.out.println("Parameters: " + destinationFolder + ", " +
fileName + ", " + overwrite);
System.out.println("Checking file " + filePath);
if (fileExists(filePath, -1)) { // updating existing file
if (overwrite) {
System.out.println("Updating file " + filePath);
editor.openFile(filePath, -1);
} else {
System.out.println("Overwrite set to false, ignoring " + filePath);
return false;
}
} else { // creating new file
System.out.println("Adding file " + filePath);
editor.addFile(filePath, null, -1);
}
editor.applyTextDelta(filePath, null);
SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
String checksum = deltaGenerator.sendDelta(filePath, new
ByteArrayInputStream(data), editor, true);
editor.closeFile(filePath, checksum);
return true;
}
public boolean fileExists(String path, long revision) throws
SVNException {
readRepository.setLocation(readRepository.getRepositoryRoot(true),
true);
SVNNodeKind kind = readRepository.checkPath(path, revision);
System.out.println("Kind found: " + kind);
if (kind == SVNNodeKind.FILE) {
return true;
}
return false;
}
And I get this output:
Parameters: CommonModules/ISO8583/releases/ivytest/,
PayTrue.PayStudio.Common.IS
O8583.dll, true
Checking file CommonModules/ISO8583/releases/ivytest//
PayTrue.PayStudio.Common.I
SO8583.dll
Kind found: file
Updating file CommonModules/ISO8583/releases/ivytest//
PayTrue.PayStudio.Common.I
SO8583.dll
Parameters: CommonModules/ISO8583/releases/ivytest/,
PayTrue.PayStudio.Common.IS
O8583.dll.sha1, true
Checking file CommonModules/ISO8583/releases/ivytest//
PayTrue.PayStudio.Common.I
SO8583.dll.sha1
Kind found: none
Adding file CommonModules/ISO8583/releases/ivytest//
PayTrue.PayStudio.Common.ISO
8583.dll.sha1
Aborting transaction
BUILD FAILED
D:\projects\CommonModules\ISO8583\branches\m35\build\build.xml:21:
impossible to
publish artifacts for PayTrue#ISO8583;ivytest: java.io.IOException
at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:
318)
at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
at org.apache.tools.ant.UnknownElement.execute
(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute
(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets
(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:
1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:
1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:
104)
Caused by: java.io.IOException
at
fm.last.ivy.plugins.svnresolver.SvnRepository.commitPublishTransactio
n(SvnRepository.java:213)
at
fm.last.ivy.plugins.svnresolver.SvnResolver.commitPublishTransaction(
SvnResolver.java:58)
at org.apache.ivy.core.publish.PublishEngine.publish
(PublishEngine.java:
263)
at org.apache.ivy.core.publish.PublishEngine.publish
(PublishEngine.java:
170)
at org.apache.ivy.Ivy.publish(Ivy.java:600)
at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:
299)
... 18 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: File '/svn/
reporoot/CommonModu
les/ISO8583/releases/ivytest/
PayTrue.PayStudio.Common.ISO8583.dll.sha1' already
exists
It seems like svnkit is returning that the file doesn't exist when it
actually does?
For the record, svn info
https://sub.domain.com/svn/reporoot/CommonModules/ISO8583/releases/ivytest//PayTrue.PayStudio.Common.ISO8583.dll.sha1@HEAD
returns the proper info.
Note: I replaced some tokens to protect our setup information (like,
the url root, user, pwd, etc.)
Any help will be appreciated... have a nice day.