How can I remove my Test Classes from my ShrinkWrap Archive
java, shrinkwrap
Solution
Try this:
ShrinkWrap.create(WebArchive.class)
.addPackages(true, Filters.exclude(".*Test.class"), getCorePackages());
Problem
How can I filter classes out of my final archive? ``` public static JavaArchive unitTestJar() { return ShrinkWrap.create( JavaArchive.class ) .addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml" ) .addPackages( false, getCorePackages() ); } public static String[] getCorePackages( String... args ) { List<String> strings = Arrays.asList( "com.lm.util", "com.lm.infrastructure" ); strings.addAll( Arrays.asList( args ) ); return (String[]) strings.toArray(); } ``` I see that there's a Filter API, but I can't seem to find any examples of how to use it. Ultimately I figured I'd just remove anything that is `*Test*`. Which is easier than trying to add a class at a time.