Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Maven to download javax.comm dependency?

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

like image 325
Svante Avatar asked Mar 15 '11 10:03

Svante


People also ask

How do I manually download a dependency in Maven?

You can use the Maven Dependency Plugin to download dependencies. Run mvn dependency:copy-dependencies , to download all your dependencies and save them in the target/dependency folder. You can change the target location by setting the property outputDirectory .

Why Maven dependencies are not getting downloaded?

If you run Maven and it fails to download your required dependencies it's likely to be caused by your local firewall & HTTP proxy configurations. See the Maven documentation for details of how to configure the HTTP proxy.

Does Maven download dependencies of dependencies?

When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. It helps to avoid references to dependencies stored on remote machine every time a project is build.

How do I add a dependency in Maven?

Add a Java Maven Dependency to the Utility ProjectRight-click the utility project, and select Maven>Add Dependency. Type a dependency name in the Enter groupID… field (e.g., commons-logging) to search for a dependency. Select the dependency, and click OK.


2 Answers

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

like image 113
Romain Linsolas Avatar answered Oct 16 '22 03:10

Romain Linsolas


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]
like image 31
Sean Patrick Floyd Avatar answered Oct 16 '22 04:10

Sean Patrick Floyd