码迷,mamicode.com
首页 > 其他好文 > 详细

错误之处(一)

时间:2019-06-07 12:47:40      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:解决   ring   bat   http   imp   idea   oca   netflix   cheng   

错误之处:如下是 pom.xml 文件,目前只有这个文件部分 dependency 报红影响一些外部jar包导入和其类库方法的使用!

技术图片

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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
    </parent>
    <groupId>com.xuecheng</groupId>
    <artifactId>xc-framework-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <java.version>1.8</java.version>
        <tomcat.version>8.5.28</tomcat.version>
        <spring-boot.version>2.0.1.RELEASE</spring-boot.version>
        <springframework.version>5.0.5.RELEASE</springframework.version>
        <mybatis-spring-boot.version>1.3.1</mybatis-spring-boot.version>
        <mybatis.version>3.4.5</mybatis.version>
        <druid.version>1.1.6</druid.version>
        <mysql-connector-java.version>5.1.45</mysql-connector-java.version>


        <commons-io.version>2.6</commons-io.version>
        <org.apache.commons.io.version>1.3.2</org.apache.commons.io.version>
        <commons-fileupload.version>1.3.3</commons-fileupload.version>
        <commons-codec.version>1.10</commons-codec.version>
        <commons-lang3.version>3.6</commons-lang3.version>
        <okhttp.version>3.9.1</okhttp.version>
        <feign-okhttp.version>8.18.0</feign-okhttp.version>
        <lombok.version>1.16.16</lombok.version>
        <springfox-swagger.version>2.7.0</springfox-swagger.version>
        <fastjson.version>1.2.30</fastjson.version>
        <fastdfs-client-java.version>1.27.0.0</fastdfs-client-java.version>
        <mysql-connector-java.version>5.1.40</mysql-connector-java.version>
        <elasticsearch.version>6.2.1</elasticsearch.version>
        <guava.version>24.0-jre</guava.version>
    </properties>
    <!--test-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Finchley.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql-connector-java.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>${mybatis-spring-boot.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
                <version>1.2.4</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>${druid.version}</version>
            </dependency>

            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>${okhttp.version}</version>
            </dependency>
            <dependency>
                <groupId>com.netflix.feign</groupId>
                <artifactId>feign-okhttp</artifactId>
                <version>${feign-okhttp.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-io</artifactId>
                <version>${org.apache.commons.io.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>${commons-fileupload.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons-codec.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${springfox-swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${springfox-swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${fastjson.version}</version>
            </dependency>
            <dependency>
                <groupId>net.oschina.zcx7878</groupId>
                <artifactId>fastdfs-client-java</artifactId>
                <version>${fastdfs-client-java.version}</version>
            </dependency>

            <dependency>
                <groupId>org.elasticsearch.client</groupId>
                <artifactId>elasticsearch-rest-high-level-client</artifactId>
                <version>${elasticsearch.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/org.elasticsearch/elasticsearch -->
            <dependency>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch</artifactId>
                <version>${elasticsearch.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>
    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <!-- &lt;!&ndash; 资源文件拷贝插件 &ndash;&gt;
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
                 <configuration>
                     <encoding>UTF-8</encoding>
                 </configuration>
             </plugin>-->
            <!-- java编译插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

具体信息:IDEA 15.0.6 + Spring Boot 2.0.1——》mysql、pagehelper、druid等部分依赖包在 External Libraries 没看到 maven 自动下载的 JAR 包

自我判断:疑似 maven 根本没去自动导入缺失的部分 jar 包——》为什么导入不了部分 jar 包?——》

自我解决1:首先怀疑联网中断问题——》右侧蓝色 maven project 进行 clean + install 并且 reimport (没用)

自我解决2:怀着悲壮的心情,将原 External Libraries 的 Maven 下载的 jar 包备份——》然后找到一份已经下载了(具备了)所有需要的 jar 包的 Libraries 文件夹并且【替换】原 Libraries ——》然而 点击maven 的 reimport,发现又变为原来的 Libraries !

自我解决3:把 lib 里面的 jar 包 + target 文件全部删除——》reimport——》结果同上

技术图片

震惊!有部分写在dependency里面却得不到maven自动下载的jar包?

技术图片

神奇!左侧 maven 明明没有自动导入 apache.commons.io ,右侧居然没报错?

技术图片

好像是 jar 的 版本问题,真就是版本问题阿???

错误之处(一)

标签:解决   ring   bat   http   imp   idea   oca   netflix   cheng   

原文地址:https://www.cnblogs.com/Roni-i/p/10987792.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!