simpleitk的Maven依赖是什么?

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

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 -->

&lt;!-- https://mvnrepository.com/artifact/org.itk.simple/simpleitk --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.itk.simple&lt;/groupId&gt;
    &lt;artifactId&gt;simpleitk&lt;/artifactId&gt;
    &lt;version&gt;0.9.0&lt;/version&gt;
    &lt;type&gt;pom&lt;/type&gt;
&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:

&lt;repository&gt;
    &lt;id&gt;ImageJ&lt;/id&gt;
    &lt;url&gt;https://maven.imagej.net/content/repositories/releases/&lt;/url&gt;
&lt;/repository&gt;
&lt;repository&gt;
    &lt;id&gt;mvnrepository&lt;/id&gt;
    &lt;name&gt;mvnrepository&lt;/name&gt;
    &lt;url&gt;https://www.mvnrepository.com&lt;/url&gt;
&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 文件可能不足够,因为您需要在系统上安装本地绑定,但您可以尝试添加以下内容:

<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:

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

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:

    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;com.example&lt;/groupId&gt;
&lt;artifactId&gt;myProject&lt;/artifactId&gt;
&lt;version&gt;1.0.0&lt;/version&gt;
&lt;properties&gt;
&lt;maven.compiler.source&gt;20&lt;/maven.compiler.source&gt;
&lt;maven.compiler.target&gt;20&lt;/maven.compiler.target&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;/properties&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.jzy3d&lt;/groupId&gt;
&lt;artifactId&gt;vtk-java-all&lt;/artifactId&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.itk.simple&lt;/groupId&gt;
&lt;artifactId&gt;simpleitk&lt;/artifactId&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;version&gt;0.9.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
&lt;artifactId&gt;junit-jupiter&lt;/artifactId&gt;
&lt;version&gt;5.8.0&lt;/version&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;version&gt;4.13.2&lt;/version&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
&lt;artifactId&gt;hamcrest&lt;/artifactId&gt;
&lt;scope&gt;compile&lt;/scope&gt;
&lt;version&gt;2.2&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;repositories&gt;
&lt;repository&gt;
&lt;id&gt;jzy3d-snapshots&lt;/id&gt;
&lt;name&gt;Jzy3d Snapshots&lt;/name&gt;
&lt;url&gt;https://maven.jzy3d.org/snapshots/&lt;/url&gt;
&lt;/repository&gt;
&lt;repository&gt;
&lt;id&gt;jzy3d-releases&lt;/id&gt;
&lt;name&gt;Jzy3d Releases&lt;/name&gt;
&lt;url&gt;https://maven.jzy3d.org/releases/&lt;/url&gt;
&lt;/repository&gt;
&lt;repository&gt;
&lt;id&gt;imagej.public&lt;/id&gt;
&lt;url&gt;https://maven.imagej.net/content/groups/public&lt;/url&gt;
&lt;/repository&gt;
&lt;repository&gt;
&lt;id&gt;scijava.public&lt;/id&gt;
&lt;url&gt;https://maven.scijava.org/content/repositories/public/&lt;/url&gt;
&lt;/repository&gt;
&lt;/repositories&gt;
&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:

确定