@@ -21,14 +21,7 @@ class DependencyResolverSpecification extends DepSpecification {
2121 ' Implementation-Title' : implementationTitle,
2222 ' Implementation-Version' : implementationVersion,
2323 ]
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)
3225
3326 when :
3427 def dependencies = DependencyResolver . resolve(file. toURI())
@@ -66,6 +59,18 @@ class DependencyResolverSpecification extends DepSpecification {
6659 ' com.samskivert.jmustache' | ' jmustache' | ' 1.14.0' | null | null | ' jmustache-1.14.jar' || ' com.samskivert:jmustache' | ' 1.14'
6760 }
6861
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+
6974 void ' jar without pom.properties get resolved with hash' () {
7075 expect :
7176 knownJarCheck(
@@ -328,4 +333,23 @@ class DependencyResolverSpecification extends DepSpecification {
328333 assert dep. version == opts[' version' ]
329334 assert dep. hash == opts[' hash' ]
330335 }
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+ }
331355}
0 commit comments