英文:
what is the dependency of simpleitk for maven?
问题
第一次使用Maven,在mvnrepository.com搜索'simpleitk'返回以下内容:
<!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk -->
<!-- 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>
这个不起作用,因为它不在Maven使用的中央仓库中。
错误:找不到artifact org.itk.simple:simpleitk:jar:0.9.0
我发现有标签<repositories>
,我可以在其中放置一个<repository>
,我尝试了:
<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>
错误:无法传输artifact org.itk.simple:simpleitk:pom:0.9.0从mvnrepository (https://www.mvnrepository.com):状态代码:403,原因短语:禁止(403)
有人可以帮我吗?
我尝试了很多次搜索Maven的'simpleitk'依赖项,但找不到任何内容。
英文:
first time using maven, searching for 'simpleitk' in mvnrepository.com returns this:
<!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk -->
<!-- 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.
答案1
得分: 1
只有 Simpleitk 的 POM 文件可以从 ImageJ 存储库中获取。二进制文件在那里不可用。您可以通过浏览存储库来查看:
https://maven.imagej.net/content/repositories/releases/org/itk/simple/simpleitk/0.9.0/
至于如何使用 Maven 解决此问题,不幸的是,可能不像添加 Maven 存储库和依赖关系那么简单。从 ImageJ 论坛上的这篇帖子 可以看到以下内容:
有人知道是否有 SimpleITK 的 Maven 存储库吗?
以及回复:
请注意,你所要求的并不 完全 简单:SimpleITK 是一个围绕 本地 用 C++ 编写的库的 Java (和Python) 封装器。
因此,您将面临与平台相关的开发的所有精彩问题:您需要确保您拥有正确的一组库,针对您的特定操作系统和 CPU 编译,与您的其他库一起正常工作(这在 Linux 上的 libstdc++ 问题上尤为突出,您不能简单地将您的 ITK 库移到同一 CPU 上的同一操作系统的另一个版本上,然后期望一切正常工作)。
您还将遇到这样的问题,根据您的平台,您需要将库放在系统库搜索路径中的目录中,或者放在 PATH 环境变量和/或 java.library.path 属性引用的目录中(这必须在启动 Java 运行时环境之前设置,之后的更改将被相当明显地忽略)。
这些本地库可以附加到 Maven 存储库的 .jar 构件作为附属构件[1],但您将永远不会真正做到跨平台无关了。
关于如何在 Java 中使用它的说明在这里:
https://simpleitk.readthedocs.io/en/master/setUp.html#setup-java
不过,我在这个存储库中找到了 simpleitk 的二进制文件:
https://maven.scijava.org/content/groups/public/org/itk/simple/simpleitk/0.9.0/
其中有一个 JAR 文件 - 但我还没有尝试过。根据之前的所有信息,仅仅拥有一个 JAR 文件可能不足够,因为您需要在系统上安装本地绑定,但您可以尝试添加以下内容:
<repository>
<id>scijava</id>
<url>https://maven.scijava.org/content/groups/public</url>
</repository>
但不能保证它会工作。
英文:
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.
答案2
得分: 0
我已修复它,至少是Maven的问题。现在我可以导入库并且智能感知正常工作。
我的pom.xml没有错误或警告:
<?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>
英文:
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>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论