سؤال

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

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

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]

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]    

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.

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top