Maven error: unmappable character for encoding Cp1251 - java

Can't compile your project in NetBeans, here is the error:
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.094s
Finished at: Sat Nov 17 00:23:08 MSK 2012
Final Memory: 8M/247M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project AdminCmd: Compilation failure
C:\Users\Максим\Documents\NetBeansProjects\AdminCmd\src\main\java\be\Balor\Tools\Help\String\ACMinecraftFontWidthCalculator.java:[30,33] error: unmappable character for encoding Cp1251
-> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
here's the file maven on that swears
http://pastebin.com/buQEE4Fb
Project to Git - https://github.com/Belphemur/AdminCmd
If someone could put a working draft of NetBeans or Eclipse!

This is interesting, as your pom.xml mentions
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
.. but the error message complains about Cp1251 encoding. Does the maven output mention anything else related to source encodings?
My recommendation is generally to not use any high-ASCII characters in your code, and use the \uxxxx notation instead as needed.
You can make the conversion from UTF-8 to escaped unicode at online conversion sites like http://www.endmemo.com/convert/EMUnicode.php (this particular one seems to strip leading zeroes, I don't think that's legal in Java)

In my case I resolved that problem by setting new environment variable:
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
In the command line executing maven, run current command before executing maven command:
SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

You have characters in that file which are likely not mapped in the Windows codepage (which is the reference to Cp1251). Try changing the project encoding to UTF-8 or similar. Look into different encoding schemes.

Related

MojoExecutionException Maven

I'm running my Java application using Mavin and after the running, I have this message:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Fatal error compiling: error: invalid target release: 16 -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Could you help me please
I had exactly the same problem:
Eclipse 2021-06
maven-compiler-plugin v3.8.1
-> "invalid target release: 16"
Changing the default JRE under "Preferences/Installed JREs" from 14 to 16 fixed this for me. (The Build was set correctly to JDK 16 all along, so Maven should have been using the 16 Runtime Environment which was pointed at JDK 16, but it obviously wasn't)
Go to java build path and set JAVA_HOME to jdk not to JDK_DIR/jre

Maven install fails with my IntelliJ setting

I'm using this basic maven command :
mvn install
It stops, with the following error :
[WARNING] File /home/vagrant/MyProject/application/declic2Parent/.idea/encodings.xml contains prohibited string.
[...]
[INFO]------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]------------------------------------------------------------------------
[INFO] Total time: 5.575s
[INFO] Finished at: Fri Jun 29 17:09:42 CEST 2018
[INFO] Final Memory: 24M/737M
[INFO]------------------------------------------------------------------------
[ERROR] Failed to execute goal com.rte.maven.plugin:encoding-maven-plugin:1.0.0.1:descriptor (executionEncoding) on project declic2Parent: We detect encoding errors on various files - see log! -> [Help 1]
What settings do I have to add in my pom.xml to tell him to stop looking in the IntelliJ directory ?
If I delete the file automatically created by IntelliJ the maven install succeeds.
It's never a good idea to play with auto-generated files.
If you use characters like ñ, é, etc you may get this errors.
It may get fixed if you add a encoding.
Like this:
<configuration>
<encoding>UTF-8</encoding>
</configuration>

Neo4j-spatial maven build failure

I know there is a similar question to this (to question: Neo4j Spatial: can't run spatial), however that question seems to be solved when installing dependencies. I think that is not the solution to my case.
After installing Neo4j and installing maven
$ brew install neo4j
$ brew install maven
making a directory called spatial and cloning neo4j-spatial to this folder.
$ git clone https://github.com/neo4j-contrib/spatial.git
Then i tried to maven install this git clone.
/spatial$ mvn install
After a lot of test it returns a "Build failure"
Results :
Failed tests:
ProgressLoggingListenerTest.testProgressLoggingListnerWithAllLogs:38->testProgressLoggingListenerWithSpecifiedWaits:62
Argument(s) are different! Wanted:
forwardingPrintStream.println(
"100.00 (10/10) - Completed test"
);
-> at org.neo4j.gis.spatial.ProgressLoggingListenerTest.testProgressLoggingListenerWithSpecifiedWaits(ProgressLoggingListenerTest.java:62)
Actual invocation has different arguments:
forwardingPrintStream.println(
"10,00 (1/10) - Running test"
);
-> at org.neo4j.gis.spatial.rtree.ProgressLoggingListener.lambda$new$1(ProgressLoggingListener.java:45)
ProgressLoggingListenerTest.testProgressLoggingListnerWithOnlyStartAndEnd:46->testProgressLoggingListenerWithSpecifiedWaits:62
Argument(s) are different! Wanted:
forwardingPrintStream.println(
"100.00 (10/10) - Completed test"
);
-> at org.neo4j.gis.spatial.ProgressLoggingListenerTest.testProgressLoggingListenerWithSpecifiedWaits(ProgressLoggingListenerTest.java:62)
Actual invocation has different arguments:
forwardingPrintStream.println(
"10,00 (1/10) - Running test"
);
-> at org.neo4j.gis.spatial.rtree.ProgressLoggingListener.lambda$new$1(ProgressLoggingListener.java:45)
Tests run: 146, Failures: 2, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10:34 min
[INFO] Finished at: 2016-09-23T15:55:35+02:00
[INFO] Final Memory: 44M/558M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project neo4j-spatial: There are test failures.
[ERROR]
[ERROR] Please refer to /Volumes/Macintosh HD/Users/Tom/spatial/target/surefire-reports for the individual test results.
[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
In my queeste to solve this "Build failure" I discovered that most maven install errors are due to dependencies. However these error messages do not indicate any missing dependencies?
I tried using mvn verify however this just seems to try to build the plugin again returning the same Build failure.
/spatial$ mvn verify
Two questions;
- Am I missing dependencies or is the problem in something else?
- If I am missing dependencies, what are they and how to install them?
Thanks in advance!
The tests depend on the locale of the build environment as it checks the result of number formatting with decimal number, expecting a point as the decimal separator:
"100.00 (10/10) - Completed test"
Your locale uses the comma as the decimal separator, based on the actual value reported:
"10,00 (1/10) - Running test"
You have 2 options:
Build the project without running the tests:
mvn install -Dmaven.test.skip
Change the locale for the build:
LANG=C mvn install
or
LANG=en_US mvn install

Maven Surefire plugin "error in starting fork" while building project with Intellij IDEA

I was trying building a Java plugin with Maven using Intellij IDEA until I came across an error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.803 s
[INFO] Finished at: 2015-06-16T16:34:55-10:00
[INFO] Final Memory: 17M/216M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project mc-hyperchat: Error occurred in starting fork, check output in log -> [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 realize that this is because of this line (that I found using the -X flag)
Forking command line: cmd.exe /X /C ""D:\Program Files\Java\jdk1.8.0_45\jre\bin\java" -jar C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefirebooter8505511050498586005.jar C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefire5990474653240919844tmp C:\Users\<username>\Documents\+GIT\mc-hyperchat\target\surefire\surefire_08408900793313340679tmp"
The system cannot find the path specified.
I happen to come across somebody else with the exact same problem:
Maven Surefire 2.13 fails to fork on Windows
The accepted answer seems to be that his JAVA_HOME environment variable was invalid, so I checked mine:
I also echoed the variable on the Command Prompt to make sure it didn't have any quotation marks in it (also me running cmd.exe to see another The system cannot find the path specified message):
I'm convinced my JAVA_HOME environment variable is correct. If that's the case, what else could've caused this problem?
I found this to be a windows related error -
Open the Registry Editor
Navigate to HKCU\Software\Microsoft\Command Processor\AutoRun and clear the values.
Also check HKLM\Software\Microsoft\Command Processor\AutoRun.

Maven Error No POM in this Project when performing archetype:generate

I am trying my hands on the Akka Pi java tutorials
I am trying to creaate a maven project as stated in the tutorial
but any time I enter the command to create a maven project I get an error.
Below are the command and the Error.
C:\Program Files\akka-2.0.2>mvn archetype:generate \
C:\Program Files\akka-2.0.2>mvn archetype:generate \
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.206s
[INFO] Finished at: Wed Sep 26 02:50:38 BST 2012
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
in this directory (C:\Program Files\akka-2.0.2). Please verify you invoked Mave
n from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception
looks like maven is requesting for the POM file but it is not stated in the tutrials that I have to create a POM before generating the project.
I am actually new too maven so pardon me.
I am using maven version :3.0.4
and akka version 2.0.2
but the tutorial uses akka version 2.0.1 but i donn't think that is the problem
any suggestion please.
thank you
remove the \ then it should start to query for more informations.
I have no windows here, but on linux it shows the same behavior with
mvn archetype:generate /
HTH R
When some tutorials describes a mvn command to be executed that is covered in two rows or more, they might add an extra backslash at the new line (of the instruction) to indicate that the same command continues on next line.
This backslash should be removed BEFORE executing the command. For instance the command for setting up a Jersey Web Application might look like this:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \
-DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.2
but should be launched as below, without backslash:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.2
If NOT removing this extra backslash you might get the error you described above.

Categories