simpleitk的Maven依赖是什么?

huangapple go评论119阅读模式
英文:

what is the dependency of simpleitk for maven?

问题

第一次使用Maven,在mvnrepository.com搜索'simpleitk'返回以下内容:

  1. <!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk -->
  2. <!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk -->
  3. <dependency>
  4. <groupId>org.itk.simple</groupId>
  5. <artifactId>simpleitk</artifactId>
  6. <version>0.9.0</version>
  7. <type>pom</type>
  8. </dependency>

这个不起作用,因为它不在Maven使用的中央仓库中。
错误:找不到artifact org.itk.simple:simpleitk:jar:0.9.0

我发现有标签<repositories>,我可以在其中放置一个<repository>,我尝试了:

  1. <repository>
  2. <id>ImageJ</id>
  3. <url>https://maven.imagej.net/content/repositories/releases/</url>
  4. </repository>
  5. <repository>
  6. <id>mvnrepository</id>
  7. <name>mvnrepository</name>
  8. <url>https://www.mvnrepository.com</url>
  9. </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 -->

  1. &lt;!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk --&gt;
  2. &lt;dependency&gt;
  3. &lt;groupId&gt;org.itk.simple&lt;/groupId&gt;
  4. &lt;artifactId&gt;simpleitk&lt;/artifactId&gt;
  5. &lt;version&gt;0.9.0&lt;/version&gt;
  6. &lt;type&gt;pom&lt;/type&gt;
  7. &lt;/dependency&gt;

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 &lt;repositories&gt;, where i can put a &lt;repository&gt;,
i tried:

  1. &lt;repository&gt;
  2. &lt;id&gt;ImageJ&lt;/id&gt;
  3. &lt;url&gt;https://maven.imagej.net/content/repositories/releases/&lt;/url&gt;
  4. &lt;/repository&gt;
  5. &lt;repository&gt;
  6. &lt;id&gt;mvnrepository&lt;/id&gt;
  7. &lt;name&gt;mvnrepository&lt;/name&gt;
  8. &lt;url&gt;https://www.mvnrepository.com&lt;/url&gt;
  9. &lt;/repository&gt;

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 文件可能不足够,因为您需要在系统上安装本地绑定,但您可以尝试添加以下内容:

  1. <repository>
  2. <id>scijava</id>
  3. <url>https://maven.scijava.org/content/groups/public</url>
  4. </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:

  1. &lt;repository&gt;
  2. &lt;id&gt;scijava&lt;/id&gt;
  3. &lt;url&gt;https://maven.scijava.org/content/groups/public&lt;/url&gt;
  4. &lt;/repository&gt;

No guarantees it will work though.

答案2

得分: 0

我已修复它,至少是Maven的问题。现在我可以导入库并且智能感知正常工作。

我的pom.xml没有错误或警告:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>com.example</groupId>
  7. <artifactId>myProject</artifactId>
  8. <version>1.0.0</version>
  9. <properties>
  10. <maven.compiler.source>20</maven.compiler.source>
  11. <maven.compiler.target>20</maven.compiler.target>
  12. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  13. </properties>
  14. <dependencies>
  15. <dependency>
  16. <groupId>org.jzy3d</groupId>
  17. <artifactId>vtk-java-all</artifactId>
  18. <scope>compile</scope>
  19. <version>1.0.0-SNAPSHOT</version>
  20. </dependency>
  21. <dependency>
  22. <groupId>org.itk.simple</groupId>
  23. <artifactId>simpleitk</artifactId>
  24. <scope>compile</scope>
  25. <version>0.9.0</version>
  26. </dependency>
  27. <dependency>
  28. <groupId>org.junit.jupiter</groupId>
  29. <artifactId>junit-jupiter</artifactId>
  30. <version>5.8.0</version>
  31. <scope>compile</scope>
  32. </dependency>
  33. <dependency>
  34. <groupId>junit</groupId>
  35. <artifactId>junit</artifactId>
  36. <version>4.13.2</version>
  37. <scope>compile</scope>
  38. </dependency>
  39. <dependency>
  40. <groupId>org.hamcrest</groupId>
  41. <artifactId>hamcrest</artifactId>
  42. <scope>compile</scope>
  43. <version>2.2</version>
  44. </dependency>
  45. </dependencies>
  46. <repositories>
  47. <repository>
  48. <id>jzy3d-snapshots</id>
  49. <name>Jzy3d Snapshots</name>
  50. <url>https://maven.jzy3d.org/snapshots/</url>
  51. </repository>
  52. <repository>
  53. <id>jzy3d-releases</id>
  54. <name>Jzy3d Releases</name>
  55. <url>https://maven.jzy3d.org/releases/</url>
  56. </repository>
  57. <repository>
  58. <id>imagej.public</id>
  59. <url>https://maven.imagej.net/content/groups/public</url>
  60. </repository>
  61. <repository>
  62. <id>scijava.public</id>
  63. <url>https://maven.scijava.org/content/repositories/public/</url>
  64. </repository>
  65. </repositories>
  66. </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:

  1. &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  2. &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
  3. xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  4. xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  5. &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  6. &lt;groupId&gt;com.example&lt;/groupId&gt;
  7. &lt;artifactId&gt;myProject&lt;/artifactId&gt;
  8. &lt;version&gt;1.0.0&lt;/version&gt;
  9. &lt;properties&gt;
  10. &lt;maven.compiler.source&gt;20&lt;/maven.compiler.source&gt;
  11. &lt;maven.compiler.target&gt;20&lt;/maven.compiler.target&gt;
  12. &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  13. &lt;/properties&gt;
  14. &lt;dependencies&gt;
  15. &lt;dependency&gt;
  16. &lt;groupId&gt;org.jzy3d&lt;/groupId&gt;
  17. &lt;artifactId&gt;vtk-java-all&lt;/artifactId&gt;
  18. &lt;scope&gt;compile&lt;/scope&gt;
  19. &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
  20. &lt;/dependency&gt;
  21. &lt;dependency&gt;
  22. &lt;groupId&gt;org.itk.simple&lt;/groupId&gt;
  23. &lt;artifactId&gt;simpleitk&lt;/artifactId&gt;
  24. &lt;scope&gt;compile&lt;/scope&gt;
  25. &lt;version&gt;0.9.0&lt;/version&gt;
  26. &lt;/dependency&gt;
  27. &lt;dependency&gt;
  28. &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
  29. &lt;artifactId&gt;junit-jupiter&lt;/artifactId&gt;
  30. &lt;version&gt;5.8.0&lt;/version&gt;
  31. &lt;scope&gt;compile&lt;/scope&gt;
  32. &lt;/dependency&gt;
  33. &lt;dependency&gt;
  34. &lt;groupId&gt;junit&lt;/groupId&gt;
  35. &lt;artifactId&gt;junit&lt;/artifactId&gt;
  36. &lt;version&gt;4.13.2&lt;/version&gt;
  37. &lt;scope&gt;compile&lt;/scope&gt;
  38. &lt;/dependency&gt;
  39. &lt;dependency&gt;
  40. &lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
  41. &lt;artifactId&gt;hamcrest&lt;/artifactId&gt;
  42. &lt;scope&gt;compile&lt;/scope&gt;
  43. &lt;version&gt;2.2&lt;/version&gt;
  44. &lt;/dependency&gt;
  45. &lt;/dependencies&gt;
  46. &lt;repositories&gt;
  47. &lt;repository&gt;
  48. &lt;id&gt;jzy3d-snapshots&lt;/id&gt;
  49. &lt;name&gt;Jzy3d Snapshots&lt;/name&gt;
  50. &lt;url&gt;https://maven.jzy3d.org/snapshots/&lt;/url&gt;
  51. &lt;/repository&gt;
  52. &lt;repository&gt;
  53. &lt;id&gt;jzy3d-releases&lt;/id&gt;
  54. &lt;name&gt;Jzy3d Releases&lt;/name&gt;
  55. &lt;url&gt;https://maven.jzy3d.org/releases/&lt;/url&gt;
  56. &lt;/repository&gt;
  57. &lt;repository&gt;
  58. &lt;id&gt;imagej.public&lt;/id&gt;
  59. &lt;url&gt;https://maven.imagej.net/content/groups/public&lt;/url&gt;
  60. &lt;/repository&gt;
  61. &lt;repository&gt;
  62. &lt;id&gt;scijava.public&lt;/id&gt;
  63. &lt;url&gt;https://maven.scijava.org/content/repositories/public/&lt;/url&gt;
  64. &lt;/repository&gt;
  65. &lt;/repositories&gt;
  66. &lt;/project&gt;

huangapple
  • 本文由 发表于 2023年6月13日 04:54:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76460264.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定