maven无法找到依赖basiclti-util

时间:2015-04-16 08:46:36

标签: java maven pom.xml

我需要在我的电子学习平台中实施LTI Consumer

我试图运行此代码LTI example Java

这是pom.xml文件

<?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>net.paulgray</groupId>
<artifactId>ExampleLtiApp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>MockLtiApp</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <springVersion>4.0.6.RELEASE</springVersion>
</properties>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${springVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${springVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${springVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-messaging</artifactId>
        <version>${springVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-websocket</artifactId>
        <version>${springVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.imsglobal</groupId>
        <artifactId>basiclti-util</artifactId>
        <version>1.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>javax.websocket</groupId>
        <artifactId>javax.websocket-api</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.4.1</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>7.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

maven不包含basic-util-1.0.1-SNAPSHOT 所以我将其编辑为

    <dependency>
        <groupId>org.imsglobal</groupId>
        <artifactId>basiclti-util</artifactId>
        <version>1.1.1</version>
    </dependency>

但它给了我这个错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ExampleLtiApp: Compilation failure: Compilation failure:
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[29,30] package org.imsglobal.basiclti does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[30,30] package org.imsglobal.basiclti does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[74,5] cannot find symbol
[ERROR] symbol:   class LtiSigner
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[78,56] cannot find symbol
[ERROR] symbol:   class LtiVerificationResult
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我该如何解决这个问题?

修改

我尝试过basiclti-util-1.0.0,但它给出了这个错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ExampleLtiApp: Compilation failure: Compilation failure:
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/JsonReader.java:[5,43] package org.imsglobal.lti2.objects.consumer does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[29,30] cannot find symbol
[ERROR] symbol:   class LtiSigner
[ERROR] location: package org.imsglobal.basiclti
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[31,43] package org.imsglobal.lti2.objects.consumer does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[32,43] package org.imsglobal.lti2.objects.provider does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[33,43] package org.imsglobal.lti2.objects.provider does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[34,43] package org.imsglobal.lti2.objects.provider does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[74,5] cannot find symbol
[ERROR] symbol:   class LtiSigner
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[155,13] cannot find symbol
[ERROR] symbol:   class ToolProfile
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[204,13] cannot find symbol
[ERROR] symbol:   class SecurityContract
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[116,9] cannot find symbol
[ERROR] symbol:   class ToolConsumer
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[116,70] cannot find symbol
[ERROR] symbol:   class ToolConsumer
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[122,9] cannot find symbol
[ERROR] symbol:   class ToolProxy
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[122,28] cannot find symbol
[ERROR] symbol:   class ToolProxy
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[123,23] cannot find symbol
[ERROR] symbol:   variable ToolProxy
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[156,9] cannot find symbol
[ERROR] symbol:   class ToolProfile
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[156,30] cannot find symbol
[ERROR] symbol:   class ToolProfile
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[188,49] package ToolConsumer does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[193,47] package ToolConsumer does not exist
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[205,9] cannot find symbol
[ERROR] symbol:   class SecurityContract
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] /home/feras/NetBeansProjects/LTIEX/lti-example-java/src/main/java/net/paulgray/exampleltiapp/LtiController.java:[205,41] cannot find symbol
[ERROR] symbol:   class SecurityContract
[ERROR] location: class net.paulgray.exampleltiapp.LtiController
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

2 个答案:

答案 0 :(得分:0)

使用

<dependency>
    <groupId>org.imsglobal</groupId>
    <artifactId>basiclti-util</artifactId>
    <version>1.0.0</version>
</dependency>

版本1.0.0包含basiclti包。版本1.1.1删除了basiclti包

答案 1 :(得分:0)

lti-example-java已过时,并使用了basiclti-util-java的旧分支(其中包结构与1.0.01.0.1不兼容)。

它已更新,现在应该正常工作。