Two issues with the current impl:
1. the represented ArchivePath already exists as ArchiveAsset, so there is no need to attempt to import it
2. it silently fail to delete the existing ArchivePath after import, so it throws exception when trying to overwrite the existing path.
String path = "a.jar"; ShrinkWrap.create(WebArchive.class) .addAsLibraries( ShrinkWrap.create(JavaArchive.class, path) .add(EmptyAsset.INSTANCE, "something")) .getAsType( GenericArchive.class, ArchivePaths.create("WEB-INF/lib", path), ArchiveFormat.ZIP);
org.jboss.shrinkwrap.api.IllegalOverwriteException: Cannot add requested asset org.jboss.shrinkwrap.api.asset.ArchiveAsset@49873ad9 to path /WEB-INF/lib/a.jar to archive 77b80d55-7637-4b87-9ac6-802aab489af3.war; path already exists as directory at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.addAsset(MemoryMapArchiveBase.java:195) at org.jboss.shrinkwrap.impl.base.MemoryMapArchiveBase.add(MemoryMapArchiveBase.java:127) at org.jboss.shrinkwrap.impl.base.ArchiveBase.getAsType(ArchiveBase.java:305) at org.jboss.shrinkwrap.impl.base.container.ContainerBase.getAsType(ContainerBase.java:467)
- relates to
-
SHRINKWRAP-476 Cannot delete nested archive if added asLibrary
- Resolved