如何从我的最终存档中过滤出类?
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();
}
我看到有一个 Filter API ,但我似乎找不到任何有关如何使用它的示例。最后我想我应该删除任何 *Test*
的东西。这比尝试一次添加一个类更容易。
最佳答案
试试这个:
ShrinkWrap.create(WebArchive.class)
.addPackages(true, Filters.exclude(".*Test.class"), getCorePackages());
关于java - 如何从我的 ShrinkWrap 存档中删除我的测试类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21839912/