[
https://issues.apache.org/jira/browse/TINKERPOP-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15563267#comment-15563267
]
Paul Jackson commented on TINKERPOP-1493:
-----------------------------------------
I attempted to create a pull request for this, but after I forked the master
branch the gremlin-groovy tests are skipping DependencyGrabberIntegrateTest for
a reason that wasn't obvious to me.
At any rate, the key lines of code (in 3.2.2) are in DependencyGrabberTest.java
line 36:
{code}private static final File extTestDir = new
File(TestHelper.makeTestDataDirectory(DependencyGrabberTest.class));{code}
and these methods in DependencyGrabber.groovy
{code}
private Set<URI> getAdditionalDependencies(final Path extPath, final
Artifact artifact) {
try {
def pathToInstalled = extPath.resolve(artifact.artifact + "-" +
artifact.version + ".jar")
final JarFile jar = new JarFile(pathToInstalled.toFile())
try {
final Manifest manifest = jar.getManifest()
def attrLine =
manifest.mainAttributes.getValue("Gremlin-Plugin-Dependencies")
def additionalDependencies = [] as Set<URI>
if (attrLine != null) {
def splitLine = attrLine.split(";")
splitLine.each {
def artifactBits = it.split(":")
def additional = new Artifact(artifactBits[0],
artifactBits[1], artifactBits[2])
final def additionalDep = makeDepsMap(additional)
additionalDependencies.addAll(Grape.resolve([classLoader:
this.classLoaderToUse], null, additionalDep))
}
}
return additionalDependencies
} finally {
jar.close()
}
} catch (Exception ex) {
throw new RuntimeException(ex)
}
}
{code}
{code}
private Set<URI> getAdditionalDependencies(final Path extPath, final
Artifact artifact) {
try {
def pathToInstalled = extPath.resolve(artifact.artifact + "-" +
artifact.version + ".jar")
final JarFile jar = new JarFile(pathToInstalled.toFile())
try {
final Manifest manifest = jar.getManifest()
def attrLine =
manifest.mainAttributes.getValue("Gremlin-Plugin-Dependencies")
def additionalDependencies = [] as Set<URI>
if (attrLine != null) {
def splitLine = attrLine.split(";")
splitLine.each {
def artifactBits = it.split(":")
def additional = new Artifact(artifactBits[0],
artifactBits[1], artifactBits[2])
final def additionalDep = makeDepsMap(additional)
additionalDependencies.addAll(Grape.resolve([classLoader:
this.classLoaderToUse], null, additionalDep))
}
}
return additionalDependencies
} finally {
jar.close()
}
} catch (Exception ex) {
throw new RuntimeException(ex)
}
}
{code}
where jar is closed in a finally block. Hope this helps.
> Groovy project doesn't build on Windows
> ---------------------------------------
>
> Key: TINKERPOP-1493
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1493
> Project: TinkerPop
> Issue Type: Bug
> Components: groovy
> Affects Versions: 3.2.2
> Reporter: Paul Jackson
> Priority: Minor
>
> Builds on Windows fail for two reasons. First the line to create extTestDir
> is creating a path consisting of two full paths concatenated together. The
> second drive letter is seen as an illegal character:
> {code}private static final File extTestDir = new
> File(System.getProperty("user.dir"),
> TestHelper.makeTestDataDirectory(DependencyGrabberTest.class));{code}
> Second, when it comes time to delete the directory it is locked. This is
> because some instances of JarFile are created on it but not closed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)