1

我的 pom.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>
<project
 xsi:schemaLocation=
 "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
 xmlns=
 "http://maven.apache.org/POM/4.0.0" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.pw</groupId>
 <artifactId>pocketwaitress-android</artifactId>
 <name>PocketWaitress Android</name>
 <packaging>apk</packaging>
 <version>1.0</version>
 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 </properties>
 <repositories>         
      <repository>
           <id>org.springframework.maven.snapshot</id>
           <name>Spring Maven Snapshot Repository</name>
           <url>http://maven.springframework.org/snapshot</url>
           <releases>
                <enabled>false</enabled>
           </releases>
           <snapshots>
                <enabled>true</enabled>
           </snapshots>
      </repository><!-- For developing against latest Spring milestones -->
      <repository>
           <id>org.springframework.maven.milestone</id>
           <name>Spring Maven Milestone Repository</name>
           <url>http://maven.springframework.org/milestone</url>
           <snapshots>
                <enabled>false</enabled>
           </snapshots>
      </repository>
    <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>

 </repositories>
 <build>
      <sourceDirectory>src</sourceDirectory>
      <finalName>${project.artifactId}</finalName>
      <plugins>
           <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
           <artifactId>android-maven-plugin</artifactId>
           <version>3.3.2</version>
           <configuration>
                <sdk>
                     <platform>7</platform>
                     <path>D:/WorkFolder/Android-SDK2</path>
                </sdk>
                <emulator>
                     <avd>WVGA-2.1</avd>
                </emulator>
                <deleteConflictingFiles>true</deleteConflictingFiles>
                <undeployBeforeDeploy>false</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
           </plugin>
           <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
           </plugin>
      </plugins>
 </build>
 <dependencies>
      <dependency>
           <groupId>com.google.android</groupId>
           <artifactId>android</artifactId>
           <version>2.1.2</version>
           <scope>provided</scope>
      </dependency>
      <dependency>
           <groupId>org.springframework.android</groupId>
           <artifactId>spring-android-rest-template</artifactId>
           <version>1.0.0.BUILD-SNAPSHOT</version>
      </dependency>
      <dependency>
           <groupId>com.pw</groupId>
           <artifactId>model</artifactId>
           <version>1.0.0</version>
      </dependency>
      <dependency>
           <groupId>org.codehouse.jackson</groupId>
           <artifactId>jackson-core-asl</artifactId>
           <version>1.9.9</version>
      </dependency>
      <dependency>
           <groupId>org.codehouse.jackson</groupId>
           <artifactId>jackson-mapper-asl</artifactId>
           <version>1.9.9</version>
      </dependency>
      </dependencies>

最新的插件是 Jackson 依赖项。

部署的输出是:

    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building PocketWaitress Android 1.0
    [INFO] ------------------------------------------------------------------------
    Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.pom
    [WARNING] The POM for org.codehouse.jackson:jackson-core-asl:jar:1.9.9 is missing, no dependency information available
    Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.pom
    [WARNING] The POM for org.codehouse.jackson:jackson-mapper-asl:jar:1.9.9 is missing, no dependency information available
    Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-core-asl/1.9.9/jackson-core-asl-1.9.9.jar
    Downloading: http://repo1.maven.org/maven2/org/codehouse/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.jar
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Skipping PocketWaitress Android
    [INFO] This project has been banned from the build due to previous failures.
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.313s
    [INFO] Finished at: Wed Sep 12 12:50:48 CEST 2012
    [INFO] Final Memory: 20M/174M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project pocketwaitress-android: Could not resolve dependencies for project com.pw:pocketwaitress-android:apk:1.0: The following artifacts could not be resolved: org.codehouse.jackson:jackson-core-asl:jar:1.9.9, org.codehouse.jackson:jackson-mapper-asl:jar:1.9.9: Failure to find org.codehouse.jackson:jackson-core-asl:jar:1.9.9 in http://maven.springframework.org/milestone was cached in the local repository, resolution will not be reattempted until the update interval of org.springframework.maven.milestone has elapsed or updates are forced -> [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/DependencyResolutionException

显然,maven 设法从中央 maven 存储库下载 jackson 依赖项,但随后它也尝试从http://maven.springframework.org/milestone下载它们!这是为什么?我是否需要以某种方式定义从哪个 repo 获取哪些依赖项?没有意义...

4

2 回答 2

2

我以前见过这样的时髦错误,我通常会做两件事:

首先,确保您的 Internet 连接正常工作 - 如果 Maven 无法连接到特定存储库,它将在其他存储库中搜索工件,并且可能会给出误导性错误消息(例如似乎搜索错误的存储库)。

接下来,使用标志再次运行您的构建-U以强制更新。

同样,不确定这是不是问题,但我已经看到上述步骤修复了类似的行为。可能值得一试。

于 2012-09-12T11:55:13.267 回答
0

您的杰克逊依赖项未下载。下载成功后,您将看到类似
Downloaded: xy
Recheck your dependencies 的内容。

于 2012-09-12T11:46:07.237 回答