Salu Ramos
Salu Ramos

Reputation: 11

what is the dependency of simpleitk for maven?

first time using maven, searching for 'simpleitk' in mvnrepository.com returns this:

<!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk -->
<dependency>
    <groupId>org.itk.simple</groupId>
    <artifactId>simpleitk</artifactId>
    <version>0.9.0</version>
    <type>pom</type>
</dependency>

this does not work as it is not in the central repository used by maven. error: Could not find artifact org.itk.simple:simpleitk:jar:0.9.0

I find out that there are the tag <repositories>, where i can put a <repository>, i tried:

<repository>
    <id>ImageJ</id>
    <url>https://maven.imagej.net/content/repositories/releases/</url>
</repository>
<repository>
    <id>mvnrepository</id>
    <name>mvnrepository</name>
    <url>https://www.mvnrepository.com</url>
</repository>

error: Could not transfer artifact org.itk.simple:simpleitk:pom:0.9.0 from/to mvnrepository (https://www.mvnrepository.com): status code: 403, reason phrase: Forbidden (403)

Can anybody help me plz?

i try to search a lot for 'simpleitk' dependencies for maven but cant find anything.

Upvotes: 0

Views: 133

Answers (2)

Salu Ramos
Salu Ramos

Reputation: 11

i fix it, at least the maven problems. Now i can import the lib and intelisense works.

my pom.xml with no errors or warnings:

    <?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>com.example</groupId>
    <artifactId>myProject</artifactId>
    <version>1.0.0</version>
    <properties>
        <maven.compiler.source>20</maven.compiler.source>
        <maven.compiler.target>20</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.jzy3d</groupId>
            <artifactId>vtk-java-all</artifactId>
            <scope>compile</scope>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.itk.simple</groupId>
            <artifactId>simpleitk</artifactId>
            <scope>compile</scope>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.8.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>compile</scope>
            <version>2.2</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>jzy3d-snapshots</id>
            <name>Jzy3d Snapshots</name>
            <url>https://maven.jzy3d.org/snapshots/</url>
        </repository>
        <repository>
            <id>jzy3d-releases</id>
            <name>Jzy3d Releases</name>
            <url>https://maven.jzy3d.org/releases/</url>
        </repository>
        <repository>
            <id>imagej.public</id>
            <url>https://maven.imagej.net/content/groups/public</url>
        </repository>
        <repository>
            <id>scijava.public</id>
            <url>https://maven.scijava.org/content/repositories/public/</url>
        </repository>
    </repositories>
</project>

Upvotes: 0

prunge
prunge

Reputation: 23268

Only the POM for Simpleitk is available from the ImageJ repository. The binaries are not available there. You can see that by browsing the repository:

https://maven.imagej.net/content/repositories/releases/org/itk/simple/simpleitk/0.9.0/

As for solving the problem of how to get it working with Maven, unfortunately it might not be as simple as adding a Maven repository and dependency. From this post on the ImageJ list, it was asked:

Does anybody know if there is a maven repository for SimpleITK??

And the response:

Please note that what you ask for is not exactly trivial: SimpleITK is a Java (and Python) wrapper around a native library written in C++.

Therefore you get all the wonderful problems of platform-dependent development: you need to make sure that you have the correct set of libraries, compiled for your particular operating system and CPU, working well with your other libraries (this is a particular problem with libstdc++ on Linux, where you cannot simply take your ITK libraries to another version of the same operating system, on the same CPU, and expect things to work).

You also get the problem that depending on your platform, you need to have the libraries in a directory that is either in the system library search path or in a directory referenced by the PATH environment variable and/or the java.library.path property (that must be set before the Java Runtime Environment is started up, any changes after that will be ignored rather blatantly).

These native libraries can be attached artifacts to the .jar artifacts on the Maven repository [1], but you will never be truly platform-independent anymore.

There are instructions on how to get it working with Java here:

https://simpleitk.readthedocs.io/en/master/setUp.html#setup-java


However, I did find the simpleitk binaries in this repository:

https://maven.scijava.org/content/groups/public/org/itk/simple/simpleitk/0.9.0/

There is a JAR in there - but I haven't tried it. It sounds like from all the previous info that simply having a JAR won't be enough because you'll need native bindings installed on your system, but you can give it a try by adding:

<repository>
    <id>scijava</id>
    <url>https://maven.scijava.org/content/groups/public</url>
</repository>

No guarantees it will work though.

Upvotes: 1

Related Questions