BO YANG created MNG-7009:
----------------------------
Summary: Maven-compiler-3.1 cannot find symbol
Key: MNG-7009
URL: https://issues.apache.org/jira/browse/MNG-7009
Project: Maven
Issue Type: Bug
Components: Errors, Plugins and Lifecycle
Affects Versions: 3.6.3, 3.6.0
Environment: bo@ubontu20:~/Downloads$ java -version
openjdk version "1.8.0_272"
OpenJDK Runtime Environment (build 1.8.0_272-8u272-b10-0ubuntu1~20.04-b10)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
bo@ubontu20:~/Downloads$ mvn --version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 1.8.0_272, vendor: Private Build, runtime:
/usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-52-generic", arch: "amd64", family: "unix"
Reporter: BO YANG
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]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)