Hi list,
I have local system installation of netCDF-Java from Github:
$ git clone .../thredds.git
$ cd thredds
$ mvn install
Build works great, but I am trying to resolve dependencies to this installation
locally with another package, and I am running into problems. I am using one of
the basic netCDF-Java examples from the netCDF-Java website. This is the
pom.xml file I am using to compile, while successfully resolves the netCDF-Java
dependency:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>0.1</version>
<name>test</name>
<dependencies>
<dependency>
<groupId>edu.ucar</groupId>
<artifactId>netcdf</artifactId>
<version>4.3.8-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
However, when I try to run the example program,
$ java -cp target/test-0.1.jar Test
Exception in thread "main" java.lang.NoClassDefFoundError:
ucar/ma2/InvalidRangeException
Caused by: java.lang.ClassNotFoundException: ucar.ma2.InvalidRangeException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
If I add the netCDF jar I get:
$ java -cp ../thredds/cdm/target/netcdf-4.3.8-SNAPSHOT.jar:target/test-0.1.jar
Test
xception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at ucar.nc2.NetcdfFile.<clinit>(NetcdfFile.java:97)
at Test.main(Test.java:37)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 2 more
And so on. Is there a way to include all of these sub-dependencies
automatically, given that I already included netcdf?
Thanks,
Noah