source value 1.5 is obsolete and will be removed in a future release

前端 未结 3 628
南方客
南方客 2021-02-12 11:39

How do I prevent the two warnings below from generating an error that stops the build process ?

-compile:
    [javac] Compiling 77 source files to /Users/andev/W         


        
3条回答
  •  别那么骄傲
    2021-02-12 12:23

    This is set in the ${sdk.dir}/tools/ant/build.xml file. At the beginning of the file are many property settings, e.g.

    
    
    
    
    
    
    

    Also at the beginning of this file is a comment

    At the beginning of the file is a list of properties that can be overridden
    by adding them to your ant.properties (properties are immutable, so their
    first definition sticks and is never changed).
    

    So, in order to override any property in general and source value and target value in particular, you can put these properties into the ant.properties file in your project directory

    java.source=1.6
    java.target=1.6
    

    This overrides the default settings in ${sdk.dir}/tools/ant/build.xml and thus prevents the warnings.

提交回复
热议问题