如何让 Maven 下载 javax.comm 依赖项?

发布于 2024-10-22 01:08:01 字数 2160 浏览 2 评论 0原文

当我使用 Maven 在 Hudson 构建服务器上构建项目时,我需要 javax.comm 库。在我的项目 pom.xml 文件中,我有这样的依赖关系:

<dependency>
    <groupId>javax.comm</groupId>
    <artifactId>comm</artifactId>
    <version>2.0.3</version>
</dependency>

我还在某处读到,如果我包含存储库,我会在 javax lib 上获得更好的运气:

    <repository>
        <id>java.net repository</id>
        <url>http://download.java.net/maven/2</url>
    </repository>

我确实这样做了。我的 pom.xml 的其余部分非常标准且简约。

当我尝试在构建服务器上构建时,我得到:

Downloading: [company repo]/content/groups/public//javax/comm/comm/2.0.3/comm-2.0.3.jar
[INFO] Unable to find resource 'javax.comm:comm:jar:2.0.3' in repository java.net repository (http://download.java.net/maven/2)
Downloading: [company repo]/content/groups/public//javax/comm/comm/2.0.3/comm-2.0.3.jar
[INFO] Unable to find resource 'javax.comm:comm:jar:2.0.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) javax.comm:comm:jar:2.0.3

Try downloading the file manually from: 
  http://www.sun.com/download/products.xml?id=43208d3d

Then, install it using the command: 
  mvn install:install-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there: 
  mvn deploy:deploy-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency: 
1) com.siriusit.fisherysolution.inmcsim:InmCSim:jar:1.0-SNAPSHOT
2) javax.comm:comm:jar:2.0.3

----------

我做错了什么?

-编辑-

我最终从 Oracle 下载了 java comm lib并让我们的 Maven 管理员将其安装在我们的本地存储库上。 正如下面的答案所指出的,由于 Oracle(以及之前的 Sun)的许可证限制,java comm lib 在公共存储库上不可用。

I need the javax.comm library when building my project on our Hudson build server with Maven. In my projects pom.xml file I have the dependency like this:

<dependency>
    <groupId>javax.comm</groupId>
    <artifactId>comm</artifactId>
    <version>2.0.3</version>
</dependency>

I also read somewhere that I would have better luck with javax lib's if I included the repository:

    <repository>
        <id>java.net repository</id>
        <url>http://download.java.net/maven/2</url>
    </repository>

which I did. Rest of my pom.xml is pretty standard and minimalistic.

When I try to build on the build server I get:

Downloading: [company repo]/content/groups/public//javax/comm/comm/2.0.3/comm-2.0.3.jar
[INFO] Unable to find resource 'javax.comm:comm:jar:2.0.3' in repository java.net repository (http://download.java.net/maven/2)
Downloading: [company repo]/content/groups/public//javax/comm/comm/2.0.3/comm-2.0.3.jar
[INFO] Unable to find resource 'javax.comm:comm:jar:2.0.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) javax.comm:comm:jar:2.0.3

Try downloading the file manually from: 
  http://www.sun.com/download/products.xml?id=43208d3d

Then, install it using the command: 
  mvn install:install-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there: 
  mvn deploy:deploy-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency: 
1) com.siriusit.fisherysolution.inmcsim:InmCSim:jar:1.0-SNAPSHOT
2) javax.comm:comm:jar:2.0.3

----------

What am I doing wrong?

-edit-

I ended up downloading the java comm lib from Oracle and had our Maven admin install it on our local Repository.
As pointed out by answers below the java comm lib is not available on public repos due to license restrictions from Oracle (and Sun before them).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

萌面超妹 2024-10-29 01:08:01

如果您查看这里,在“官方" Maven 2 存储库,您将在您的库的 pom.xml 文件中看到该内容:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>javax.comm</groupId>
    <artifactId>comm</artifactId>
    <version>2.0.3</version>
    <name>Java Communications API</name>
    <description>
        The Java Communications API is a Java extension that facilitates developing platform-independent
        communications applications for technologies such as Smart Cards, embedded systems, and point-of-sale
        devices, financial services devices, fax, modems, display terminals, and robotic equipment.
    </description>
    <url>http://java.sun.com/products/javacomm/</url>
    <distributionManagement>
        <downloadUrl>http://www.sun.com/download/products.xml?id=43208d3d</downloadUrl>
    </distributionManagement>
    <dependencies></dependencies>
</project>

这意味着您应该自己下载该库(URL 在 标签),然后将其安装到本地存储库上 (或者更好的是,将其部署在您的企业存储库上)。

有时,某些库(Oracle JDBC 驱动程序是另一个示例)会发生这种情况,这些库无法直接下载,主要是因为特定许可证的原因...

If you have a look here, in the "official" Maven 2 repository, you will see that in the pom.xml file for your library:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>javax.comm</groupId>
    <artifactId>comm</artifactId>
    <version>2.0.3</version>
    <name>Java Communications API</name>
    <description>
        The Java Communications API is a Java extension that facilitates developing platform-independent
        communications applications for technologies such as Smart Cards, embedded systems, and point-of-sale
        devices, financial services devices, fax, modems, display terminals, and robotic equipment.
    </description>
    <url>http://java.sun.com/products/javacomm/</url>
    <distributionManagement>
        <downloadUrl>http://www.sun.com/download/products.xml?id=43208d3d</downloadUrl>
    </distributionManagement>
    <dependencies></dependencies>
</project>

which means that you should download the library yourself (the URL is given in <downloadUrl> tag), and then install it on your local repository (or even better, deploy it on your enterprise repository).

This happen sometimes with some libraries (the Oracle JDBC driver is another example) that are not available for direct download, essentially because of specific licenses...

江湖彼岸 2024-10-29 01:08:01

该 jar 在公共存储库中不可用,可能是出于许可原因。

下载通信 API 并使用

mvn deploy:deploy-file -DgroupId=javax.comm -DartifactId=comm \
   -Dversion=2.0.3  -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] \
   -DrepositoryId=[id]

The jar is not available in public repositories, probably for licensing reasons.

Download the Communication API and deploy it using

mvn deploy:deploy-file -DgroupId=javax.comm -DartifactId=comm \
   -Dversion=2.0.3  -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] \
   -DrepositoryId=[id]
听风吹 2024-10-29 01:08:01

实际上,maven 在公共存储库上找不到它...

[INFO] 无法在存储库 java.net 存储库 (http://download.java.net) 中找到资源 'javax.comm:comm:jar:2.0.3' /行家/2)
...
[INFO] 无法在存储库中心 (http://repo1.maven.org/maven2) 中找到资源“javax.comm:comm:jar:2.0.3”,

您必须从任何源下载它并将其安装在您的本地存储库:

mvn install:install-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file

或将其部署到您的公司存储库(如果您有):

mvn deploy:deploy-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]    

Actually maven doesn't find it on the public repos...

[INFO] Unable to find resource 'javax.comm:comm:jar:2.0.3' in repository java.net repository (http://download.java.net/maven/2)
...
[INFO] Unable to find resource 'javax.comm:comm:jar:2.0.3' in repository central (http://repo1.maven.org/maven2)

you have to download it from any source and either install it in your local repository:

mvn install:install-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file

or deploy it to your company repository (if you have one):

mvn deploy:deploy-file -DgroupId=javax.comm -DartifactId=comm -Dversion=2.0.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]    
疏忽 2024-10-29 01:08:01

由于许可限制,javax.comm 包在任何公共存储库中均不可用,请参阅此处了解更多详细信息:

http://repo1.maven.org/maven2/javax/comm/comm/2.0.3/comm-2.0.3.pom

POM还为您提供下载网址。您应该使用提供的链接下载该 jar:

http://www.sun.com /download/products.xml?id=43208d3d

并将其放置在公司存储库服务器中的“/javax/comm/comm/2.0.3/”中,像artifactory这样的服务器提供了一个Web -为此的前端。

如果您没有存储库服务器,您可以将其放置在主文件夹中的 .m2/repository 目录中。在那里创建一个目录“/javax/comm/comm/2.0.3/”,并将第一个链接中的 pom 和下载的 jar 放入此文件夹中。但这仅适用于您的本地计算机。

Because of licensing restrictions the javax.comm package isn't available in any public repositories, see here for further detais:

http://repo1.maven.org/maven2/javax/comm/comm/2.0.3/comm-2.0.3.pom

The POM also offers you the download url. You should download the jar using the provided link:

http://www.sun.com/download/products.xml?id=43208d3d

and place it in "/javax/comm/comm/2.0.3/" in your companies repository server, servers like artifactory offer a web-frontend for this.

If you don't have a repository server you can place it in your .m2/repository directory in your home folder. Create a directory "/javax/comm/comm/2.0.3/" there and place the pom from the first link and the downloaded jar in this folder. But this will only work for your local machine.

败给现实 2024-10-29 01:08:01

您还可以在源代码管理中添加工件,并在构建之前使用 maven-install-plugin 在本地安装它,如下所述 此处

You can also add the artifact in source control and use the maven-install-plugin to install it localy before the build as explained here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文