Curtis, Thanks but it is still not working.
I have cut out using NetBeans and am now just using the CLI and a text editor. POM as follows: ======================================================== <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>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>my-app</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <repositories> <repository> <id>imagej.public</id> <url>http://maven.imagej.net/content/groups/public</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>io.scif</groupId> <artifactId>scifio</artifactId> <version>0.17.1</version> </dependency> </dependencies> </project> ======================================================== File hierarchy: . ./.DS_Store ./pom.xml ./src ./src/main ./src/main/java ./src/main/java/com ./src/main/java/com/mycompany ./src/main/java/com/mycompany/app ./src/main/java/com/mycompany/app/App.java ./src/test ./src/test/java ./src/test/java/com ./src/test/java/com/mycompany ./src/test/java/com/mycompany/app ./src/test/java/com/mycompany/app/AppTest.java ======================================================== App.java as follows: package com.mycompany.app; import io.scif.FormatException; import io.scif.ImageMetadata; import io.scif.Plane; import io.scif.Reader; import io.scif.SCIFIO; public class App { public static void main( String[] args ) { try { System.out.println( "Hello World!" ); SCIFIO scifio = new SCIFIO(); String sampleImage = "8bit-signed&pixelType=int8&lengths=50,50,3,5,7&axes=X,Y,Z,Channel,Time.fake"; final Reader reader = scifio.initializer().initializeReader(sampleImage); System.out.printf("reader=%s%n", reader ); } catch (Exception e) { System.out.printf("Exception: %s%n", e.getMessage() ); } } } ======================================================== mvm -U install [Michaels-Retina:~/temp/deleteme/my-app] michaelellis% mvn -U install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building my-app 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ my-app --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/michaelellis/temp/deleteme/my-app/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ my-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Users/michaelellis/temp/deleteme/my-app/target/classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ my-app --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/michaelellis/temp/deleteme/my-app/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ my-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Users/michaelellis/temp/deleteme/my-app/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ my-app --- [INFO] Surefire report directory: /Users/michaelellis/temp/deleteme/my-app/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.mycompany.app.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app --- [INFO] Building jar: /Users/michaelellis/temp/deleteme/my-app/target/my-app-1.0-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app --- [INFO] Installing /Users/michaelellis/temp/deleteme/my-app/target/my-app-1.0-SNAPSHOT.jar to /Users/michaelellis/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.jar [INFO] Installing /Users/michaelellis/temp/deleteme/my-app/pom.xml to /Users/michaelellis/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.962 s [INFO] Finished at: 2014-12-05T16:59:50+00:00 [INFO] Final Memory: 18M/242M [INFO] ———————————————————————————————————— ======================================================== mvn claims to build everything OK there seems to be no inclusion of any scif libraries or class files. When I run it I get: [Michaels-Retina:~/temp/deleteme/my-app] michaelellis% java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: io/scif/SCIFIO at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2699) at java.lang.Class.privateGetMethodRecursive(Class.java:3046) at java.lang.Class.getMethod0(Class.java:3016) at java.lang.Class.getMethod(Class.java:1782) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: io.scif.SCIFIO at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more ======================================================== I’ve been banging my head against this for two days now. So any help appreciated On 5 Dec 2014, at 16:35, Curtis Rueden <ctrue...@wisc.edu> wrote: > Hi Michael, > > > The POM for io.scif:scifio:jar:0.17.1 is missing, no dependency > > information available > > Make sure you have the following <repositories> block in your POM: > > <repositories> > <repository> > <id>imagej.public</id> > <url>http://maven.imagej.net/content/groups/public</url> > </repository> > </repositories> > > Then rebuild with the "-U" flag. I don't know how to do this from NetBeans, > but you only need to do it once from the CLI -- then you can return to > NetBeans and it should work. > > Regards, > Curtis > > On Fri, Dec 5, 2014 at 6:07 AM, Michael Ellis <michael.el...@dsuk.biz> wrote: > I have followed the advice offered by Curtis regarding adding the io.scif: > scifio dependency to my POM > > The dependency part of my POM looks like this: > > <dependencies> > <dependency> > <groupId>net.imglib2</groupId> > <artifactId>imglib2</artifactId> > <version>2.2.1-SNAPSHOT</version> > <type>jar</type> > </dependency> > <dependency> > <groupId>io.scif</groupId> > <artifactId>scifio</artifactId> > <version>0.17.1</version> > <type>jar</type> > </dependency> > </dependencies> > > I am using NetBeans IDE, configured for use with maven project (I am slo > using Java 8 and JavaFX) > > However when I attempt to Build (or Build with Dependencies) within > NetBeans, I get the following error message: > ============================================================ > > cd /Users/michaelellis/Documents/Development/MavenImgLib2FX; > JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home > "/Applications/NetBeans/NetBeans > 8.0.app/Contents/Resources/NetBeans/java/maven/bin/mvn" install > Scanning for projects... > > ------------------------------------------------------------------------ > Building MavenImgLib2FX 1.0-SNAPSHOT > ------------------------------------------------------------------------ > The POM for io.scif:scifio:jar:0.17.1 is missing, no dependency information > available > ------------------------------------------------------------------------ > BUILD FAILURE > ------------------------------------------------------------------------ > Total time: 0.341s > Finished at: Fri Dec 05 10:34:41 GMT 2014 > Final Memory: 7M/245M > ------------------------------------------------------------------------ > Failed to execute goal on project MavenImgLib2FX: Could not resolve > dependencies for project biz.dsuk:MavenImgLib2FX:jar:1.0-SNAPSHOT: Failure to > find io.scif:scifio:jar:0.17.1 in http://repo.maven.apache.org/maven2 was > cached in the local repository, resolution will not be reattempted until the > update interval of central has elapsed or updates are forced -> [Help 1] > > To see the full stack trace of the errors, re-run Maven with the -e switch. > Re-run Maven using the -X switch to enable full debug logging. > > For more information about the errors and possible solutions, please read the > following articles: > [Help 1] > http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException > > ============================================================ > > If I open a terminal window and cd into the project directory and: > > mvn clean package > > It succeeds. > > However, when I then attempt to run the project with: > > java -cp MavenImgLib2FX-1.0-SNAPSHOT.jar biz.dsuk.mavenimglib2fx.MainApp > > The application starts to execute but throws “No compatible service: > io.scif.SCIFIOService” exception. > ============================================================ > > img1=CellImg [20x30] > BufferedImage=BufferedImage@3137c585: type = 10 ColorModel: #pixelBits = 8 > numComponents = 1 color space = java.awt.color.ICC_ColorSpace@134d9d5f > transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: > width = 707 height = 699 #numDataElements 1 dataOff[0] = 0 > Loading image... > Exception in Application start method > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at > com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:363) > at > com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) > Caused by: java.lang.RuntimeException: Exception in Application start method > at > com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875) > at > com.sun.javafx.application.LauncherImpl.lambda$launchApplication$150(LauncherImpl.java:157) > at > com.sun.javafx.application.LauncherImpl$$Lambda$50/553264065.run(Unknown > Source) > at java.lang.Thread.run(Thread.java:745) > Caused by: java.lang.IllegalArgumentException: No compatible service: > io.scif.SCIFIOService > at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:243) > at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194) > at > org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:170) > at org.scijava.Context.<init>(Context.java:244) > at org.scijava.Context.<init>(Context.java:203) > at org.scijava.Context.<init>(Context.java:142) > at org.scijava.Context.<init>(Context.java:128) > at io.scif.SCIFIO.<init>(SCIFIO.java:81) > at biz.dsuk.mavenimglib2fx.MainApp.start(MainApp.java:38) > at > com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$156(LauncherImpl.java:821) > at > com.sun.javafx.application.LauncherImpl$$Lambda$53/681110827.run(Unknown > Source) > at > com.sun.javafx.application.PlatformImpl.lambda$runAndWait$169(PlatformImpl.java:326) > at > com.sun.javafx.application.PlatformImpl$$Lambda$47/693632176.run(Unknown > Source) > at > com.sun.javafx.application.PlatformImpl.lambda$null$167(PlatformImpl.java:295) > at > com.sun.javafx.application.PlatformImpl$$Lambda$49/1260282780.run(Unknown > Source) > at java.security.AccessController.doPrivileged(Native Method) > at > com.sun.javafx.application.PlatformImpl.lambda$runLater$168(PlatformImpl.java:294) > at > com.sun.javafx.application.PlatformImpl$$Lambda$48/1364335809.run(Unknown > Source) > at > com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) > Exception running application biz.dsuk.mavenimglib2fx.MainApp > ============================================================ > > If I remove the calls to the SCIO code and build and run from the command > line, all works well. > > The SCIO source code that I am using is lifted/amended from one of the > tutorials and is as follows: > > ============================================================ > imagePath = > "8bit-signed&pixelType=int8&lengths=50,50,3,5,7&axes=X,Y,Z,Channel,Time.fake"; > System.out.println("Loading image... '" + imagePath + "'"); > SCIFIO scifio = new SCIFIO(); > final Reader reader = > scifio.initializer().initializeReader(imagePath); > ============================================================ > > This source code works file in the SCIFIO tutorial. > > Any help gratefully appreciated!!!!! > > — Michael Ellis > > > > > On 3 Dec 2014, at 19:31, Curtis Rueden <ctrue...@wisc.edu> wrote: > >> Hi Michael, >> >> > How do I establish what Maven projects I need to include? >> >> One way to check is using the dependency-maven-plugin like so: >> >> mvn dependency:analyze >> >> This will tell you: >> >> A) Dependencies you declared but do not actually use; and >> B) Dependencies you did not declare directly, but actually need. >> >> Note that this will only work if your project compiles successfully. In >> other words, it is easier to start with "too many" dependencies and pare >> down, rather than trying to "build up" from zero. >> >> So in your case, you can start with the ImgLib2 Examples dependencies block, >> run dependency:analyze, and adjust the POM according to its recommendations. >> >> > When I go to my NetBeans project dependence, select Add dependency, >> > then type SCIF to the query text box, I get a huge list of >> > possibilities. >> >> The dependency you probably want is io.scif:scifio (i.e.: a groupId of >> io.scif, and an artifactId of scifio). Presumably at the latest version. You >> can search for that here: >> >> http://maven.imagej.net/index.html#nexus-search;gav~io.scif~scifio~~~ >> >> So your dependency block in this case would be: >> >> <dependency> >> <groupId>io.scif</groupId> >> <artifactId>scifio</artifactId> >> <version>0.17.1</version> >> </dependency> >> >> Note that that block of XML is available for copy-pasting from the link >> above. >> >> > I am completely new to maven >> >> For more information, see: >> http://imagej.net/Maven >> >> Regards, >> Curtis >> >> On Tue, Dec 2, 2014 at 6:05 PM, Michael Ellis <michael.el...@dsuk.biz> wrote: >> I am investigating the using ImgLib2 for a project. >> >> I am using NetBeans and have managed to create a NetBeans Mavern project and >> have added a dependency for ImgLib2 Core Library and that seems to be >> working OK. >> >> I now want to add the least possible requirements for the purpose of opening >> some image files. >> >> How do I establish what Maven projects I need to include? >> >> I have cloned the ImgLib2 Examples project and got that working but that >> seems to include all manner of things that I suspect I do not need. >> >> When I go to my NetBeans project dependence, select Add dependency, then >> type SCIF to the query text box, I get a huge list of possibilities. >> >> I am completely new to maven and so do not know what I am doing with it! >> >> — Michael Ellis >> Digital Scientific UK Ltd. >> >> >> >> >> _______________________________________________ >> ImageJ-devel mailing list >> ImageJ-devel@imagej.net >> http://imagej.net/mailman/listinfo/imagej-devel >> >> > > > _______________________________________________ > ImageJ-devel mailing list > ImageJ-devel@imagej.net > http://imagej.net/mailman/listinfo/imagej-devel > >
_______________________________________________ ImageJ-devel mailing list ImageJ-devel@imagej.net http://imagej.net/mailman/listinfo/imagej-devel