Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7009

Maven-compiler-3.1 cannot find symbol

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 3.6.0, 3.6.3
    • None
    • None

    Description

      The project could be compiled by eclipse. But when I package use maven by `mvn clean package`,  it reports some symbols cannot find. Below is the full output. It is a demo project to reproduce the error (https://github.com/boyang9602/demo).

      ```

      ~/eclipse-workspace/demo (master|✚ 2) ✔ $ mvn compile
      [INFO] Scanning for projects...
      [INFO]
      [INFO] -------------------------< com.github:demo >--------------------------
      [INFO] Building demo 0.0.1-SNAPSHOT
      [INFO] -------------------------------[ jar ]--------------------------------
      [INFO]
      [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ demo —
      [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 0 resource
      [INFO]
      [INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ demo —
      [INFO] Changes detected - recompiling the module!
      [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
      [INFO] Compiling 1 source file to /home/bo/eclipse-workspace/demo/target/classes
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR :
      [INFO] -------------------------------------------------------------
      [ERROR] /home/bo/eclipse-workspace/demo/src/main/java/demo/Demo.java:[16,79] cannot find symbol
      symbol: variable line
      location: class java.lang.Object
      [INFO] 1 error
      [INFO] -------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.876 s
      [INFO] Finished at: 2020-11-03T09:42:37-05:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project demo: Compilation failure
      [ERROR] /home/bo/eclipse-workspace/demo/src/main/java/demo/Demo.java:[16,79] cannot find symbol
      [ERROR] symbol: variable line
      [ERROR] location: class java.lang.Object
      [ERROR]
      [ERROR] -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

      ```

      I also created a stack overflow post, where it has a more detailed description about what I did: https://stackoverflow.com/questions/64656908/maven-compiler-3-1-cannot-find-symbol

       
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            bo535a BO YANG
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: