For Mvn goal executae mavenmultiprojectdirectory takes wrong path it point to home directory
已回答
When running mvn goal for the project it does point to wrong project path. As mvn goal runs following command:
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Dmaven.multiModuleProjectDirectory=/home/username/ -Dmaven.home=/home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/plugins/maven/lib/maven3 -Dclassworlds.conf=/home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/plugins/maven/lib/maven3/bin/m2.conf -Dmaven.ext.class.path=/home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/plugins/maven/lib/maven-event-listener.jar -javaagent:/home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/lib/idea_rt.jar=41637:/home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/bin -Dfile.encoding=UTF-8 -classpath /home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar:/home/username/ideaIU-2022.2.3/idea-IU-222.4345.14/plugins/maven/lib/maven3/boot/plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2022.2.3 clean package -am -amd -pl :project_name -DskipTests -Dunit.skipTests -Dintegration.skipTests -Dscoverage.skip -Djacoco.skip
The correct argument for the -Dmaven.multiModuleProjectDirectory=/home/username/projectname
How can we fix the issue for this.
请先登录再写评论。
Could you try running the same maven goal from command line (outside of IntelliJ) and see if it points to incorrect project path?
Just to clarify if it is an issue within the IDE.
Yes from a terminal I am able to build the code without any issues.
Pratiks11 can you please attach screenshot of the Maven run configuration for this Maven goal you are running from IDE?
Does setting the Working directory in this run configuration help?
As another possible workaround you can add
into .mvn/jvm.config file in the project root directory.
Hello Andrey Dernov.
Thanks for the reply.
I am attaching the screenshot for the maven run configuration.
Yes Tried to add the value in the .mvn/maven.config file but it did not help. :(
Even if I run the goal it does not point to the correct file while running the goal. For example in my project, I have some configuration files at the top level. But if I run mvn goal through IDE. It points to the /home/username/file.conf. Instead of /home/username/MyExample/file.conf.
But If I run the same command through the terminal it works without any problem.