[shrinkwrap-issues] [JBoss JIRA] (SHRINKWRAP-492) addPackages method not ever succeeds

Aslak Knutsen (JIRA) issues at jboss.org
Wed Aug 26 19:52:43 EDT 2015


    [ https://issues.jboss.org/browse/SHRINKWRAP-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102273#comment-13102273 ] 

Aslak Knutsen edited comment on SHRINKWRAP-492 at 8/26/15 7:52 PM:
-------------------------------------------------------------------

The root cause seems to be that the h2.jar is packged without 'folder' entires in the zip file. With no folder/directory/package entries Classloader.getResources("org/h2") returns no found which means ShrinkWrap won't see the h2.jar as a possible target for 'deep' scanning.

As en example if you print the entries in the jars

drools.jar:
org/drools/core/event/rule/
org/drools/core/event/rule/impl/
org/drools/core/event/rule/impl/ActivationCancelledEventImpl.class

\h2.jar:
org/h2/bnf/Sentence.java
org/h2/command/Command.java
org/h2/command/CommandContainer.java
org/h2/command/CommandInterface.java
org/h2/command/CommandList.java
org/h2/command/CommandRemote.java
org/h2/command/ddl/AlterIndexRename.java

Not 100% sure how to deal with it yet.. but that's at least the cause :)

A workaround would be to use ShrinkWrap Resolver to resolve the whole h2.jar directly instead of attempting to repackage it


was (Author: aslak):
The root cause seems to be that the h2.jar is packged without 'folder' entires in the zip file. With no folder/directory/package entries Classloader.getResources("org/h2") returns no found which means ShrinkWrap won't see the h2.jar as a possible target for 'deep' scanning.

As en example if you print the entries in the jars

drools.jar:
org/drools/core/event/rule/
org/drools/core/event/rule/impl/
org/drools/core/event/rule/impl/ActivationCancelledEventImpl.class

h2.jar:
org/h2/bnf/Sentence.java
org/h2/command/Command.java
org/h2/command/CommandContainer.java
org/h2/command/CommandInterface.java
org/h2/command/CommandList.java
org/h2/command/CommandRemote.java
org/h2/command/ddl/AlterIndexRename.java

Not 100% sure how to deal with it yet.. but that's at least the cause :)

A workaround would be to use ShrinkWrap Resolver to resolve the whole h2.jar directly instead of attempting to repackage it

> addPackages method not ever succeeds
> ------------------------------------
>
>                 Key: SHRINKWRAP-492
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-492
>             Project: ShrinkWrap
>          Issue Type: Bug
>          Components: impl-base
>         Environment: shrinkwrap-impl-base 1.2.2
>            Reporter: Luca Stancapiano
>
> there are cases where the addPackages method doesn't succeed to load the packages also if they are in the current classloader. An example can be the com.h2database library. This library is registered as resource in the classloader with the name com.h2database and ambigously it contains the package org.h2. 
> If I try to include the library in my shrinkwrap java archive with the expression addPackages(true, "com") or with the expression addPackages(true, "org") , the h2 packages are not loaded because shrinkwrap need the name of the resource starting with the same name of the package. 
> So seems that shrinkwrap can load only something as a resource called com.h2database combined with the package com.h2 or a resource called org.h2database combined with the package org.h2. 
> I presume this ambiguous name should be managed in shrinkwrap 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the shrinkwrap-issues mailing list