Cannot Find Symbol Error In Maven Build
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us maven compilation failure cannot find symbol Learn more about Stack Overflow the company Business Learn more about hiring developers or maven cannot find symbol dependency posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
Maven Cannot Find Symbol Method
Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up maven “cannot find symbol” message unhelpful up vote 46
Cannot Find Symbol Error In Java
down vote favorite 3 This is a really simple question, and it's probably a setting somewhere I don't know about, but Google is being particularly unhelpful for this question, giving results about compilation errors, not how to change compilation error messages. When I build my project with maven, it will give me error messages formatted roughly as follows: [ERROR] /path/to/source/Main.java:[13,8] error: cannot find symbol When I build cannot find symbol error in java interface with ant or javac, it will actually tell me the symbol that it can't find in the error message. maven gives me a line number and character position, but displaying the actual symbol would be more helpful. The line above is the only line given for each of the "cannot find symbol" errors. There is no line above or below that gives the symbol. I imagine there has to be some way to get maven to tell me that information, but I don't know what it is. I tried the -e option, as mvn told me to try using it, but it gave a maven traceback for the error, not the actual symbol. Any help? Here's the output of mvn --version Apache Maven 3.0.4 (rNON-CANONICAL_2012-10-24_11-25_mockbuild; 2012-10-24 07:25:04-0400) Maven home: /usr/share/maven Java version: 1.7.0_09-icedtea, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.6.6-1.fc17.x86_64", arch: "amd64", family: "unix" And here's an example (unhelpful) error message, exactly as output by maven (just with directories shortened): [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /path/to/source/SoundEngineFilePanel.java:[33,8] error: cannot find symbol [ERROR] class SoundEngineFilePanel /path/to/source/SoundEngineFilePanel.java:[36,8] error: cannot find symbol [INFO] 2 errors [INFO] ------------------------------------------------------------- The symbols it can'
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us
Maven-compiler-plugin
Learn more about Stack Overflow the company Business Learn more about hiring developers maven compile error symbol not found or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow maven test compile cannot find symbol Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Maven compile “Cannot find symbol” up vote 1 http://stackoverflow.com/questions/14164386/maven-cannot-find-symbol-message-unhelpful down vote favorite For some reason this command works fine with my local machine: mvn clean install -DskipTests=true -Psdk However for Codeship it does now work and throws this "Cannot find symbol" error. In Codeship the full command is: jdk_switcher use oraclejdk8 echo $JAVA_HOME mvn clean install -DskipTests=true -Psdk In the POM the repository have this:
here for a quick overview of the site Help Center Detailed answers to any questions you might have http://stackoverflow.com/questions/23327920/maven-compile-gives-cannot-find-symbol-for-a-class-sitting-in-the-same-app Meta Discuss the workings and policies of this site About Us Learn https://confluence.atlassian.com/cloverkb/maven-2-plugin-fails-with-cannot-find-symbol-exception-when-defining-two-locations-for-source-files-177340627.html more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like cannot find you, helping each other. Join them; it only takes a minute: Sign up Maven compile gives: Cannot find symbol - For a class sitting in the same app up vote 6 down vote favorite 1 It's a while since I met such puzzling issue. I'm having a class that references another one sitting in another package cannot find symbol in the same application, that is, NOT in another jar archive file. The including class is learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java The included class is /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/config/WebTestConfiguration.java Under Eclipse there is no issue and no compilation error in the editor. But running a Maven build gives a compilation error: mvn clean test-compile -Pacceptance [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project learnintouch-rest: Compilation failure: Compilation failure: [ERROR] /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java:[16,46] cannot find symbol [ERROR] symbol: class WebTestConfiguration [ERROR] location: package com.thalasoft.learnintouch.rest.config [ERROR] /home/stephane/dev/java/projects/learnintouch-rest/src/test/java/com/thalasoft/learnintouch/rest/acceptance/AbstractControllerTest.java:[21,116] cannot find symbol [ERROR] symbol: class WebTestConfiguration Here is the code of the including class: @RunWith(SpringJUnit4ClassRunner.class) @Transactional @WebAppConfiguration @ContextConfiguration(classes = { ApplicationConfiguration.class, WebSecurityConfig.class, WebConfiguration.class, WebTestConfiguration.class }) public abstract class AbstractControllerTest { This abstract test class is sitting under the acceptance test directory, which mandates the explicit activation of the -Pacceptance profile when running the Maven command. The default profile does not run this acceptance test, but only some integration test. One thing to note, is that this abstract class looks like the one abstract class used in the integration test. H
BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure C:\source\location\target\clover\src-test\com\acme\SomeClass.java:[11,35] cannot find symbol symbol: class SomeClass You have a Maven project that compiles and installs just fine, but when run with the Clover goals on it fails with the above error. The project is set up a little bit different, as the source is in two folders, for example: src/main/java/core, and src/main/java/gen. The maven-compiler-plugin is configured to handle this as below: