I get errors like the following in Eclipse using Maven:
Missing artifact org.eclipse:swt:jar:3.7.
Project 'davmail' is missing required library: '/home/buzz-dee/.m2/repository/org/eclipse/swt/3.7.0/swt-3.7.0.jar'
Most libraries are found as you can see in the above image, but some not. But the files are in the right place.:
ls ~/.m2/repository/org/eclipse/swt/3.7.0/
swt-3.7.0.jar.lastUpdated swt-3.7.0.pom.lastUpdated
This is a partial pom.xml
:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>davmail</groupId>
<artifactId>davmail</artifactId>
<packaging>jar</packaging>
<version>4.6.1</version>
<name>DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange Gateway</name>
<organization>
<name>Mickaël Guessant</name>
</organization>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xwiki</id>
<layout>default</layout>
<url>http://maven.xwiki.org/externals</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
<version>2.4.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-commons</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>swt</artifactId>
<version>3.7.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
<version>2.2</version>
</dependency>
<!-- included in Java 1.6, needed with Java 1.5 -->
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.samba.jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.14</version>
</dependency>
<dependency>
<groupId>net.freeutils.charset</groupId>
<artifactId>jcharset</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.boris.winrun4j</groupId>
<artifactId>winrun4j</artifactId>
<version>0.4.5</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
</project>
What could be wrong?
According to this DavMail page, org.eclipse:swt:jar:3.7.0
is an optional dependency. It isn't in mavenCentral, you could probably hunt it down from some other repository, but the simplest thing to do would be to remove that dependency from your pom and rebuild using -U
Alternatively, as discussed here, you can download the jar from here and install it to your local .m2 repo using the install command:
mvn install:install-file -DgroupId=org.eclipse -DartifactId=swt -Dversion=3.7.0 -Dpackaging=jar -Dfile=lib/swt-3.7-win32-x86.jar
Please note though, that this is a temporary fix, that will have to be repeated on every machine you want to build this project on. That kinda defeats the point of offloading dependency management to a tool like Maven. I would still prefer removing swt
as a dependency from your project if that works.