zoukankan      html  css  js  c++  java
  • maven编译常见错误解决方法整理

    程序包com.sun.xml.internal.ws.spi不存在

    当maven项目里面有用到JDK内部的一些类,接口(如:com.sun.xml.internal.ws.spi.ProviderImpl)等的时候,用maven编译一般会出现如下错误

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.105 s
    [INFO] Finished at: 2017-07-05T12:45:49+08:00
    [INFO] Final Memory: 21M/219M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Compilation failure
    [ERROR] /C:/Users/Administrator/Desktop/lk/src/main/java/com/lk/Test.java:[7,36] 程序包com.sun.xml.internal.ws.spi不存在
    [ERROR] -> [Help 1]
    [ERROR]

    解决方法如下:

    添加maven-compiler-plugin插件,并且配置compilerArguments

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
            <compilerArguments>
                <bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
            </compilerArguments>
        </configuration>
    </plugin>

    注意:

    1:这里的rt.jar需要配置正确的路径

    2:如果使用的类,接口等在其他的jar里面(如tools.jar),则bootclasspath值需要配置成其他的jar

    配置好之后,再编译打包,就没有问题了

  • 相关阅读:
    Spring使用JDBC配置具名参数
    linux中的匿名管道和命名管道
    linux查看CPU信息
    磁盘阵列RAID原理、种类及性能优缺点对比
    SMP和MPP的优缺点
    Hadoop datablock size
    MySQL 高可用架构之MHA
    MySQL 高可用架构之MMM
    五大常见的MySQL高可用方案
    hive加载数据
  • 原文地址:https://www.cnblogs.com/liu-ke/p/7125144.html
Copyright © 2011-2022 走看看