构建无法包含com.fasterxml.jackson.core

时间:2018-01-12 06:05:58

标签: scala maven apache-spark jackson-databind

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

central(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           [错误] - > [帮助1]           [错误]           [错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。           [ERROR]使用-X开关重新运行Maven以启用完整的调试日志记录。           [错误]           [错误]有关错误和可能解决方案的更多信息,请阅读以下文章:           [错误] [帮助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>

   
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

似乎jackson-databind 2.7.3带来了传递依赖的jackson-annotations和jackson-core 2.7.0,这可能会在你的构建中引起一些依赖冲突。 我无法准确复制你的错误,因为我没有你的整个pom。但我建议您通过以下方式修复依赖冲突:

<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>

现在你杰克小姐将会错过&#34;杰克森核心&#34;和jackson-annotation,但你可以用正确的版本(2.7.3)将它们添加到pom并应用排除技巧。