0

I am facing below problem. I thought it is because of the some special chars in the following path as "C:\Users\Meri�.m2\r". I changed the encoding type as in the most upvoted answer UTF8 Encoding but error still persist. I check the file path and I can see that there is a jar file called, maven-antrun-plugin-1.7.jar.

--- maven-antrun-plugin:1.7:run (generate-status-code-file) @ bla_bla ---
    [WARNING] Parameter tasks is deprecated, use target instead
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  6.015 s
    [INFO] Finished at: 2022-09-22T12:01:52+03:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (generate-status-code-file) on project bla_bla: An Ant BuildException has occured: The following error occurred while executing this line:
    [ERROR] java.io.FileNotFoundException: C:\Users\Meri�\.m2\repository\org\apache\maven\plugins\maven-antrun-plugin\1.7\maven-antrun-plugin-1.7.jar 
    [ERROR] -> [Help 1]

What can I do to fix this error?

Note: I imported a maven project from a repo, to my eclipse. I added specific settings.xml file added to maven settings. Then tried to build the project.

Meric Ozcan
  • 678
  • 5
  • 25
  • This looks like the local repository path in some Windows encoding was read as UTF-8, and hence not a correct path. You could somewhere edited the path in the current Windows encoding on your PC. Look [here](https://howtodoinjava.com/maven/change-local-repository-location/) for changing the local repo in a settings XML but maybe that one is not found also. Search for "Users". – Joop Eggen Sep 22 '22 at 09:23
  • Do you get a similar error with ```mvn -X``` ? Or rather, does *that* have a problem with your home directory and/or paths thereoff? – g00se Sep 22 '22 at 09:31
  • Where should I run that command? in cmd, project folder? @g00se – Meric Ozcan Sep 22 '22 at 09:33
  • In the same directory as your pom.xml. Is the name in your home dir Meriç ? – g00se Sep 22 '22 at 09:35
  • I got a different error "No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or .." Yes my home dir has chars as "ç, ö" etc @g00se – Meric Ozcan Sep 22 '22 at 09:45
  • Yes that's expected. Actually I'd be interested to see it modified to ```mvn -X 2>&1 | find /I "Maven home"``` – g00se Sep 22 '22 at 09:51
  • @g00se "C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.4" – Meric Ozcan Sep 22 '22 at 09:57
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/248251/discussion-between-g00se-and-meric-ozcan). – g00se Sep 22 '22 at 09:57

2 Answers2

1

Your problem is likely caused by a schizophrenic character encoding situation, typical of some Windows installations. It's having a problem with the Unicode/native encoding in the area of the 'complex' characters in your home directory path. If you find out the DOS name of your home dir by dir C:\Users /ad/x then you can try something like mvn -Duser.home=C:\Users\MYNAME~1 compile.

g00se
  • 3,207
  • 2
  • 5
  • 9
  • I think I can also move the project out of the special characther folder. Right? – Meric Ozcan Sep 22 '22 at 10:49
  • 1
    That might not work, because the key directory that is being queried is the local repository path, which is by default off ```${user.home}``` which is the one that's problematic. – g00se Sep 22 '22 at 12:04
  • What would maybe work is to move your local repository to a directory with plain characters and preferably no spaces. But you would have to find your settings.xml file for Maven and tell it where ```localRepository``` is, as it defaults to being off your home directory – g00se Sep 22 '22 at 12:18
  • something like this maybe *C:\settings\* – Meric Ozcan Sep 22 '22 at 14:09
  • Yes, if you don't have one already, you could even call it C:\MavenLocalRepository – g00se Sep 22 '22 at 15:27
0

Move the project out of your home directory.

Tim Kilian
  • 21
  • 6
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 26 '22 at 15:15