Maven错误 - 解决依赖关系

时间:2013-11-28 12:59:49

标签: maven dependencies

我对maven不是很熟悉,而且在运行maven编译时我正在努力解决这个错误信息:

[ERROR] Failed to execute goal on project myProject: Could not resolve dependencies for project myProject:1.0: Failure to find weka:weka:jar:3.7.1-beta in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

pom看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>myGroup</groupId>
    <artifactId>myProject</artifactId>
    <version>1.1</version>

    <repositories>
        <repository>
            <id>ambit-plovdiv</id>
            <url>
                http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/thirdparty</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>


    <dependencies>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>

        <!-- general purpose math-libraries -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math</artifactId>
            <version>2.2</version>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
        </dependency>


        <dependency>
            <groupId>net.sf.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>2.1</version>
        </dependency>

        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>1.2.4</version>
        </dependency>


        <dependency>
            <groupId>net.sourceforge.jexcelapi</groupId>
            <artifactId>jxl</artifactId>
            <version>2.6.10</version>
        </dependency>

        <dependency>
            <groupId>tablelayout</groupId>
            <artifactId>TableLayout</artifactId>
            <version>20050920</version>
        </dependency>

        <dependency>
            <groupId>org.openscience.cdk</groupId>
            <artifactId>cdk</artifactId>
            <version>1.3.8</version>
        </dependency>

        <dependency>
            <groupId>org.openscience.cdk</groupId>
            <artifactId>jchempaint</artifactId>
            <version>3.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.7-beta1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.7-beta1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.7-beta1</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <optimize>true</optimize>

                    <fork>true</fork>
                    <compilerVersion>1.6</compilerVersion>

                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

有人可以帮助理解此错误消息吗?

3 个答案:

答案 0 :(得分:2)

那是星期五......我混淆了两个maven项目。非常感谢你的帮助!

答案 1 :(得分:0)

消息的第一部分表示您的可访问存储库中缺少某个(传递)依赖项。

第二部分意味着它不是第一次发出此请求,因此除非您将其取消黑名单(例如,在您的命令中使用-U),Maven将不会尝试在远程存储库上再次找到它。

答案 2 :(得分:0)

如果您可以升级,maven central中的weka 的更高版本

或者,作为最后的手段,如果你在某个地方的maven repo中找不到所需的版本,你可以从weka网站下载你需要的jar,并将它们放在你的本地存储库中,如下所示: / p>

mvn install:install-file -Dfile=weka-3.7.1-beta.jar -DgroupId=weka -DartifactId=weka -Dversion=3.7.1-beta -DgeneratePom=true