The maven message “cannot find character” is useless

This is a very simple question, and it's probably a parameter that I don't know about, but Google is especially useless for this question, giving results about compilation errors, and not about how to change compilation error messages.

When I create my project using maven, it will give me error messages, formatted something like this:

[ERROR] /path/to/source/Main.java: [13.8] error: cannot find character

When I create using ant or javac, it will actually show me a character that it cannot find in the error message. maven gives me the line number and character position, but displaying the actual character would be more useful. The line above is the only line indicated for each error "cannot find a character". There is no line above or below that gives the symbol. I suppose there must be some way to get maven to tell me this information, but I don't know what it is. I tried the -e option since mvn asked him to try it, but he gave maven traceback for the error, not the actual character.

Any help?

Here is 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 is an example of a (useless) error message, just like maven output (only with shortened directories):

 [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 characters that he cannot find are "fakeThing" and "fakeThing2", not SoundEngineFilePanel.

+57
java maven settings compiler-errors
Jan 04 '13 at
source share
11 answers

This is a bug in the Maven compiler plugin related to JDK7, I think. Works great with JDK6.

+35
Jan 04
source share

upgrade to 3.1:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> 
+29
Sep 01 '13 at 15:58
source share

I had the same problem. The reason is because I had two JAR files that were not added through the Maven dependency, so when I ran mvn compile , the console displays an error:

The character could not be found, Class ... "

To fix this:

  • Delete JAR files from build path
  • Add to build path
  • Run mvn compile
+3
Jul 31 '16 at 15:38
source share

In my case, the problem was in the subsidiary bank, which was not rebuilt since I added a new class, the pom.xml of this subsidiary bank was not related to my failed pom.xml child-parent relationship (using the <parent> ). Therefore, I rebuilt the subsidiary bank, after which the error disappeared.

+3
Sep 21 '16 at 15:26
source share

Even I use Java 7, maven 2.2.1 and get the same error, I removed <scope>tests</scope> from my pom and used

mvn clean -DskipTests=true install to successfully create my projects without updating my version of maven.

+2
Sep 23 '13 at 10:39
source share

This is not a Maven function; This is a compiler function. Look carefully; The information you are looking for is most likely in the next line.

+1
Jan 04 '13 at
source share

My guess is that the compiler complains about invalid annotation. I noticed that Eclipse does not show all errors, such as the comma at the end of the array in the annotation. But standard javac does.

0
Jan 04 '13 at
source share

I had a similar problem in Eclipse STS when trying to start a Maven installation in a project. I changed some versions in the dependencies of my pom.xml file for this project and the projects that these dependencies pointed to. I solved this by performing a Maven installation on all the projects that I changed, and then running the installation again on the original.

0
Dec 29 '16 at 18:58
source share

I had the same problem with maven. It happens that my problem was that maven created folders with different names. I was expecting .service.MyFile, but in the destination folder it was Service / MyFile and java is case sensitive. It took me a few hours to find out, I recommend checking this out.

0
Jul 11 '17 at 2:33 on
source share

SOLUTION: @ Before creating your component (using mvn clean install). Build the entire project once and re-create your component.

WHY IS THAT:
I get this error many times. In most cases, I will try to create my component myself (since I have not made changes to another place).

Right. But this additional bank, which was recently downloaded, may affect changes made by a third party (inside their component). Creating the complete mvn clean utility throughout the project saved me several times

0
Aug 10 '17 at 11:10
source share

if you have a dependency on any other project in the workspace and these projects are not being built properly, such an error may occur. try creating such dependent projects first, this may help

0
Sep 15 '17 at 11:13 on
source share



All Articles