# HG changeset patch # User Tom Gottfried # Date 1481736733 -3600 # Node ID 961d50dde3c2c996cafd7fa85d1f3040ebf72cd5 # Parent 59bdb52bac1cbdff075894f409a3d95150aa0c0c Fix dependencies in test deployment. diff -r 59bdb52bac1c -r 961d50dde3c2 pom.xml --- a/pom.xml Tue Dec 13 20:34:36 2016 +0100 +++ b/pom.xml Wed Dec 14 18:32:13 2016 +0100 @@ -137,6 +137,7 @@ org.geotools gt-epsg-hsql 14.5 + runtime org.geotools diff -r 59bdb52bac1c -r 961d50dde3c2 src/test/java/de/intevation/lada/BaseTest.java --- a/src/test/java/de/intevation/lada/BaseTest.java Tue Dec 13 20:34:36 2016 +0100 +++ b/src/test/java/de/intevation/lada/BaseTest.java Wed Dec 14 18:32:13 2016 +0100 @@ -44,26 +44,23 @@ */ @Deployment(testable=true) public static WebArchive createDeployment() throws Exception { - File[] files = Maven.resolver().loadPomFromFile("pom.xml") - .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile(); + File antlr = Maven.resolver().loadPomFromFile("pom.xml") + .resolve("org.antlr:antlr4-runtime") + .withoutTransitivity().asSingleFile(); WebArchive archive = ShrinkWrap.create(WebArchive.class, ARCHIVE_NAME) .addPackages(true, Package.getPackage("de.intevation.lada")) .addAsResource("log4j.properties", "log4j.properties") .addAsResource("shibboleth.properties", "shibboleth.properties") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") + .addAsLibrary(antlr) .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml"); - for (File f : files) { - if (f.getName().contains("antlr4") - || f.getName().contains("gt-metadata") - || f.getName().contains("gt-opengis") - || f.getName().contains("gt-referencing") - //TODO: still something missing. One test will fail. - ) { - archive.addAsLibrary(f); - } - } + addWithDependencies("org.geotools:gt-api", archive); + addWithDependencies("org.geotools:gt-referencing", archive); + addWithDependencies("org.geotools:gt-epsg-hsql", archive); + addWithDependencies("org.geotools:gt-opengis", archive); + return archive; } @@ -78,4 +75,12 @@ public static final void afterTests() { System.out.println(""); } + + private static void addWithDependencies(String coordinate, WebArchive archive) { + File[] files = Maven.resolver().loadPomFromFile("pom.xml") + .resolve(coordinate).withTransitivity().asFile(); + for (File f : files) { + archive.addAsLibrary(f); + } + } }