zoukankan      html  css  js  c++  java
  • Error:(xx) java: -source 1.5 中不支持

    idea有两种打包方式,一种是打分散包(不包含第三方依赖,通过manifest文件中的classpath属性引用),一种是独立的包(包含所有的依赖),一直想打一个独立的包,无奈折腾了一天都搞不定,总结出了这个是idea的bug。所以目光转向了maven的Assembly Plugin 。

    下面是pom中build标签的配置,可以看到我设置了compolie为8

        <build>
            <plugins>
                <!--maven-assembly-plugin 打包-->
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <source>8</source>
                        <compolie>8</compolie>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>workmode.simplequeues.Consumer</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>

    下面的地方不忘记改成jar,不然不会把自身打包进去

    下面是报错:

    i检查idea中Java Compolier配置,编译版本为8

     检查idea中module设置 ,语言版本为8

     那个这个错误的1.5版本哪里来的呢?突然想到了maven的setting.xml配置文件,看了下,里面没有配置java版本。我们在setting.xml中profiles标签加入下面的配置

    <profile>  
          <id>jdk-1.8</id>  
          <activation>  
              <activeByDefault>true</activeByDefault>  
              <jdk>1.8</jdk>  
          </activation>  
          <properties>  
              <maven.compiler.source>1.8</maven.compiler.source>  
              <maven.compiler.target>1.8</maven.compiler.target>  
              <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>  
          </properties>   
    </profile>

    我们在maven package一下

     成功!

  • 相关阅读:
    fpga配置方式 .jic固化为ps模式
    fpga新建nios
    四轴飞行器飞行原理与双闭环PID控制
    fpga为什么要用nios 开发
    error A space is required after ',' comma-spacing
    vuex : Newline required at end of file but not found eol-last
    vue -Missing space before value for key 'path'vue.js解决空格报错
    visual studio 自动补全功能 以及代码没有颜色
    hadoop 伪分布模式环境搭建
    django框架-DRF工程之认证功能
  • 原文地址:https://www.cnblogs.com/crelle/p/13927136.html
Copyright © 2011-2022 走看看