Search code examples
shrinkwrap

How to add a package-info.class to a ShrinkWrap archive?


I have a packge-info.java file in one of my packages. It contains some package wide used annotations.

How can I add the corresponding package-info.class to a ShrinkWrap archive?


Solution

  • Ok, I found the following solution:

      archive.addPackages(false, new Filter<ArchivePath>()
      {
         @Override
         public boolean include(ArchivePath path)
         {
             return path.get().endsWith("package-info.class");
         }
      }, SDMEventBroadcaster.class.getPackage());
    

    It does what I expect but it would be nice to have a solution without a filter.