changeset 1240:961d50dde3c2

Fix dependencies in test deployment.
author Tom Gottfried <tom@intevation.de>
date Wed, 14 Dec 2016 18:32:13 +0100
parents 59bdb52bac1c
children 95d04f56266d
files pom.xml src/test/java/de/intevation/lada/BaseTest.java
diffstat 2 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
             <groupId>org.geotools</groupId>
             <artifactId>gt-epsg-hsql</artifactId>
             <version>14.5</version>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.geotools</groupId>
--- 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);
+        }
+    }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)