13

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

Svante
  • 1,069
  • 3
  • 12
  • 28
  • it seems your company repo doesn't carry javax.comm:comm:jar:2.0.3, either that, or it is unable to forward the request to someone who does..? – falstro Mar 15 '11 at 10:40
  • Why doesnt Maven just find it in the public repos when it fails to find it in my company repo? – Svante Mar 15 '11 at 10:45
  • 1
    because it isn't configured to look there. This is a standard configuration for companies, to be able to monitor/control what is being used (licensing issues being the prime cause of concern here). You should ask someone to add it to the company repo, or you'll probably run into trouble with the legal department. – falstro Mar 15 '11 at 10:50
  • Thank you to everyone for your helpful answers. – Svante Mar 15 '11 at 11:00
  • Aargh! It seems that javax.comm 2.0.3 is not available anywhere. Oracle has completely buried it or made it impossible to find. So all these answers, whatever merit they may once have had are no longer effective. Can anyone tell me where I can get a copy of java comm.jar v2.0.3 by any means at all? – Steve Cohen Feb 17 '12 at 21:47
  • it seems so... I think this is because it has very specific uses (access to particular or legacy hardware) and they might be looking for licence revenues... – Riccardo Cossu Sep 11 '12 at 08:40

5 Answers5

12

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

Community
  • 1
  • 1
Romain Linsolas
  • 79,475
  • 49
  • 202
  • 273
4

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]
Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
3

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]    
Riccardo Cossu
  • 2,699
  • 1
  • 28
  • 47
1

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.

HefferWolf
  • 3,894
  • 1
  • 23
  • 29
0

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.

Jarek Przygódzki
  • 4,284
  • 2
  • 31
  • 41