Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Eclipse/Maven项目缺少必需的库/缺少项目_Java_Eclipse_Maven_Eclipse Luna - Fatal编程技术网

Java Eclipse/Maven项目缺少必需的库/缺少项目

Java Eclipse/Maven项目缺少必需的库/缺少项目,java,eclipse,maven,eclipse-luna,Java,Eclipse,Maven,Eclipse Luna,我在使用Maven的Eclipse中遇到如下错误: 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' 如上图所示,大多数库都可以找到,但有些库不能找到。但是文件放在了正确的地方 ls ~/.m2/repository/org/ecl

我在使用Maven的Eclipse中遇到如下错误:

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'

如上图所示,大多数库都可以找到,但有些库不能找到。但是文件放在了正确的地方

ls ~/.m2/repository/org/eclipse/swt/3.7.0/
swt-3.7.0.jar.lastUpdated  swt-3.7.0.pom.lastUpdated
这是部分
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>

4.0.0
达夫迈尔
达夫迈尔
罐子
4.6.1
DavMail POP/IMAP/SMTP/Caldav/CARDAV/LDAP交换网关
米卡·盖桑特
中心的
Maven存储库交换机
违约
http://repo1.maven.org/maven2
假的
xwiki
违约
http://maven.xwiki.org/externals
假的
朱尼特
朱尼特
3.8.1
测试
org.apache.jackrabbit
jackrabbit webdav
2.4.3
org.apache.jackrabbit
jackrabbit jcr commons
xml API
xml API
org.slf4j
slf4j-log4j12
1.3.1
commons httpclient
commons httpclient
3.1
通用编解码器
通用编解码器
1.3
log4j
log4j
1.2.16
javax.jms
jms
com.sun.jdmk
jmxtools
com.sun.jmx
jmxri
javax.mail
邮件
1.4.3
javax.activation
激活
1.1.1
org.eclipse
swt
3.7.0
真的
javax.servlet
servlet api
2.4
真的
net.sourceforge.htmlcleaner
htmlcleaner
2.2
org.codehaus.woodstox
woodstox core asl
4.1.2
org.samba.jcifs
jcifs
1.3.14
net.freeutils.charset
jcharset
1.3
org.boris.winrun4j
winrun4j
0.4.5
apache.snapshots
http://repository.apache.org/snapshots
假的
src/java
org.apache.maven.plugins
maven编译器插件
1.5
1.5
org.apache.maven.plugins
maven站点插件
2.2

有什么问题吗?

忽略前面的答案

Maven central没有适用于
org.eclipse.swt
的3.7.0版。maven central的最新版本是3.3.0

您可以尝试使用3.3.0版本,也可以尝试手动添加到源文件夹中,但是,根据,
org,eclipse:swt:jar:3.7.0
是可选的依赖项。它不在mavenCentral中,您可能可以从其他存储库中找到它,但最简单的方法是从pom中删除该依赖项,并使用
-U

或者,如前所述,您可以使用install命令从下载jar并将其安装到本地.m2 repo:

mvn install:install-file -DgroupId=org.eclipse -DartifactId=swt -Dversion=3.7.0 -Dpackaging=jar -Dfile=lib/swt-3.7-win32-x86.jar

但请注意,这是一个临时修复,必须在您要构建此项目的每台计算机上重复。这有点违背了将依赖关系管理转移到Maven这样的工具上的观点。如果可行的话,我仍然希望将
swt
作为依赖项从项目中删除。

上次更新的
文件不是真正的工件。maven最后一次找他们是在那个时间戳,但没有找到他们。文件大小应该是免费的。请参阅:谢谢,我忽略了文件名
swt-3.7.0.jar.lastUpdated
中的.code>lastUpdated
。我的项目库文件夹中已经有这些文件。Maven命令是否也将文件复制到Maven repository文件夹?如果您连接到internet,只需使用-U标志运行Maven,它将强制下载依赖项。我运行了
mvn-U clean compile install
,但随后出现错误:
[error]未能在项目davmail上执行目标:无法解析项目davmail的依赖项:davmail:jar:4.6.1:在central中找不到工件org.eclipse:swt:jar:3.7.0(http://repo1.maven.org/maven2)->[Help 1]
。正如下面的人所指出的,swt:3.7在maven central中不可用。您使用的davmail版本似乎设置了错误的依赖项。我想是时候给你的pom添加更多的例外了。显然,越来越多的人对davmail传递依赖性存在问题:如果我删除了文件
swt-3.7.0.jar.lastUpdated
swt-3.7.0.pom.lastUpdated
,如果我单击“更新项目”,我会将它们取回。对于其他文件,我手动复制到该文件夹,并单击“更新项目”,该项目正在运行。SWT JAR已经在签出的源代码中。没有必要再次下载它们。