Trouble with -Xlint:all and maven

后端 未结 1 1329
庸人自扰
庸人自扰 2021-02-10 10:01

I\'m trying to get maven to output lint level warnings. I\'ve created a small test program that should generate a warning about using a static method from a non-static context,

1条回答
  •  盖世英雄少女心
    2021-02-10 10:40

    This "works for me" with your sources.

    
      4.0.0
    
      com.buck
      mavenproject3
      1.0-SNAPSHOT
      jar
    
      mavenproject3
      http://maven.apache.org
    
      
        UTF-8
      
    
      
        
          junit
          junit
          3.8.1
          test
        
      
    
      
        
          
            org.apache.maven.plugins
            maven-compiler-plugin
            3.0
            
              1.6
              1.6
              -Xlint:all
              true
              true
            
          
        
      
    
    

    I imagine that the reason your commented out attempt with

                    
                        
                    
    

    is failing because of the XML namespace "Xlint" that the "all" tag would fall into, which means that the entire tag "Xlint:all" probably wasn't even seen by the maven configuration parser (being in a different namespace and all).

    By the way, the relevant lines of output

    Compiling 1 source file to C:\Users\edwbuck\Documents\NetBeansProjects\mavenproject3\target\classes
    bootstrap class path not set in conjunction with -source 1.6
    com/buck/mavenproject3/App.java:[12,35] static method should be qualified by type name, java.lang.String, instead of by an expression
    

    and my environment

    Apache Maven 3.0.4 (r1232337; 2012-01-17 02:44:56-0600)
    Maven home: C:\Program Files\NetBeans 7.2.1\java\maven
    Java version: 1.7.0_07, vendor: Oracle Corporation
    Java home: C:\Program Files (x86)\Java\jdk1.7.0_07\jre
    Default locale: en_US, platform encoding: Cp1252
    OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
    

    Perhaps you stepped on a platform specific bug?

    0 讨论(0)
提交回复
热议问题