1

我正在使用 Java 1.8 和 Scala 2.10.5 上的 scala 和 spark 包等的依赖项来构建文件。构建在 jackson-bind 包上抛出。我添加了整个 pom 和我看到的异常: 异常

中央(https://repo.maven.apache.org/maven2,releases=true,snapshots=false)

[错误]:ClientProtocolException:无效的重定向 URI: http: //blog.goodstuff.im/repo-releases/com/fasterxml/jackson/core/jackson-databind/[2.7.0,)/jackson-databind-[2.7. 0,).jar :

Illegal character in path at index 83: http://blog.goodstuff.im/repo-releases/com/fasterxml/jackson/core/jackson-databind/[2.7.0,)/jackson-databind-[2.7.0,).jar

尝试了排除标签,它仍然失败并出现错误:

ClientProtocolException:重定向 URI 无效:http: //blog.goodstuff.im/repo-releases/com/fasterxml/jackson/core/jackson-databind/[2.7.0,)/jackson-databind-[2.7.0,)。 jar:索引 83 处路径中的非法字符:http: //blog.goodstuff.im/repo-releases/com/fasterxml/jackson/core/jackson-databind/[2.7.0,)/jackson-databind-[2.7. 0,).jar [ERROR] -> [Help 1] [ERROR] [ERROR] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。[错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。[ERROR] [ERROR] 有关错误和可能的解决方案的更多信息,请阅读以下文章: [ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我的 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>com.mycompany</groupId>
    <artifactId>c-platform</artifactId>
    <version>3.0.0-SNAPSHOT</version>
    <name>${project.version} - ${project.artifactId}</name>
    <packaging>pom</packaging>
    <parent>     <groupId>com.mycompany</groupId>
        <artifactId>c-parent</artifactId>
        <version>3.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <repositories>

        <repository>
            <id>Nexus</id>
            <url>…-snapshots/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
             <id> Nexus shapshot</id>
             <url>../nexus/content/groups/public</url>
             <releases>
                 <enabled>true</enabled>
             </releases>
             <snapshots>
                 <enabled>true</enabled>
             </snapshots>
         </repository>
        <repository>
            <id>Cloudera</id>
            <url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>scala-tools.org</id>
            <name>Scala-tools Maven2 Repository</name>
            <url>http://scala-tools.org/repo-releases</url>
        </repository>

        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Java.net Repository for Maven</name>
            <url>http://download.java.net/maven/2/</url>
            <layout>default</layout>
        </repository>

    </repositories>


    <!-- list all dependencies - begin -->

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>com.maxmind.geoip2</groupId>
            <artifactId>geoip2</artifactId>
            <version>2.7.0</version>
        </dependency>
        <dependency>
            <groupId>com.databricks</groupId>
            <artifactId>spark-csv_2.10</artifactId>
            <version>${spark.csv.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.10</artifactId>
            <version>${spark.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.10</artifactId>
            <version>${spark.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-mllib_2.10</artifactId>
            <version>${spark.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-hive_2.10</artifactId>
            <version>${spark.version}</version>
        </dependency>
       <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-scala_2.11</artifactId>
            <version>2.7.3</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.7.3</version>
            <exclusions>
                <exclusion>
                    <artifactId>jackson-annotations</artifactId>
                    <groupId>com.fasterxml.jackson.core</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jackson-core</artifactId>
                    <groupId>com.fasterxml.jackson.core</groupId>
                </exclusion>
            </exclusions>
        </dependency>

    </dependencies>

    <!-- list all dependencies - emd -->
    <build>
        <sourceDirectory>src/main/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <relocations>
                                <relocation>
                                    <pattern>com.fasterxml.jackson.**</pattern>
                                    <shadedPattern>com.shaded.fasterxml.jackson@1</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <args>
                                <arg>-dependencyfile</arg>
                                <arg>${project.build.directory}/.scala_dependencies</arg>
                            </args>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

   

4

1 回答 1

0

似乎 jackson-databind 2.7.3 带来了传递依赖,jackson-annotations 和 jackson-core 2.7.0 可能会在您的构建中导致一些依赖冲突。我无法准确重现您的错误,因为我没有您的整个 pom.xml 文件。但我建议您通过以下方式解决依赖冲突:

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.7.3</version>
      <exclusions>
        <exclusion>
          <artifactId>jackson-annotations</artifactId>
          <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
           <artifactId>jackson-core</artifactId>
           <groupId>com.fasterxml.jackson.core</groupId>
         </exclusion>
     </exclusions>
</dependency>

现在你jackon-bind会错过“jackson-core”和jackson-annotation,但你可以使用正确的版本(2.7.3)将它们添加到pom并应用排除技巧。

于 2018-01-12T06:27:25.993 回答