@@ -21,14 +21,7 @@ class DependencyResolverSpecification extends DepSpecification {
21
21
' Implementation-Title' : implementationTitle,
22
22
' Implementation-Version' : implementationVersion,
23
23
]
24
- File file = new File (testDir, filename)
25
- ZipOutputStream out = new ZipOutputStream (new FileOutputStream (file))
26
- ZipEntry e = new ZipEntry (" META-INF/MANIFEST.MF" )
27
- def manifest = attributes. findAll { it. value != null }. collect { k , v -> " $k : $v " }. join(' \n ' )
28
- out. putNextEntry(e)
29
- out. write(manifest. getBytes(Charset . forName(' UTF-8' )))
30
- out. closeEntry()
31
- out. close()
24
+ File file = prepareJar(filename, attributes)
32
25
33
26
when :
34
27
def dependencies = DependencyResolver . resolve(file. toURI())
@@ -66,6 +59,18 @@ class DependencyResolverSpecification extends DepSpecification {
66
59
' com.samskivert.jmustache' | ' jmustache' | ' 1.14.0' | null | null | ' jmustache-1.14.jar' || ' com.samskivert:jmustache' | ' 1.14'
67
60
}
68
61
62
+ private File prepareJar (final filename , final attributes ) {
63
+ File file = new File (testDir, filename)
64
+ ZipOutputStream out = new ZipOutputStream (new FileOutputStream (file))
65
+ ZipEntry e = new ZipEntry (" META-INF/MANIFEST.MF" )
66
+ def manifest = attributes. findAll { it. value != null }. collect { k , v -> " $k : $v " }. join(' \n ' )
67
+ out. putNextEntry(e)
68
+ out. write(manifest. getBytes(Charset . forName(' UTF-8' )))
69
+ out. closeEntry()
70
+ out. close()
71
+ file
72
+ }
73
+
69
74
void ' jar without pom.properties get resolved with hash' () {
70
75
expect :
71
76
knownJarCheck(
@@ -328,4 +333,23 @@ class DependencyResolverSpecification extends DepSpecification {
328
333
assert dep. version == opts[' version' ]
329
334
assert dep. hash == opts[' hash' ]
330
335
}
336
+
337
+ void ' JBoss may use the "jar:file" format to reference jar files instead of nested jars' (){
338
+ setup :
339
+ final attributes = [
340
+ ' Bundle-SymbolicName' : null ,
341
+ ' Bundle-Name' : null ,
342
+ ' Bundle-Version' : null ,
343
+ ' Implementation-Title' : ' JUnit' ,
344
+ ' Implementation-Version' : ' 4.12' ,
345
+ ]
346
+ final file = prepareJar(" junit-4.12.jar" , attributes)
347
+ final uri = new URI (" jar:" + file. toURI()+ " !/" )
348
+
349
+ when :
350
+ final deps = DependencyResolver . resolve(uri)
351
+
352
+ then :
353
+ deps. size() == 1
354
+ }
331
355
}
0 commit comments