[英]Cannot Create Maven Web Project in Netbeans 8.2
I installed netbeans 8.2 recently and I keep trying to create a maven web project
but I'm getting this error.我最近安装了 netbeans 8.2,我一直在尝试创建
maven web project
,但我收到了这个错误。
Cannot run program "cmd" (in directory "C:\Users\Administrator\Documents\NetBeansProjects"):
Malformed argument has embedded quote: "C:\opt\apache-maven-3.6.2\bin\mvn.cmd"
-DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee7
-DarchetypeVersion=1.1 -DarchetypeRepository=http://repo.maven.apache.org/maven2
-DgroupId=com.dilini -DartifactId=mavenproject1 -Dversion=1.0-SNAPSHOT -Dpackage=com.dilini.mavenproject1
-Dbasedir=C:\Users\Administrator\Documents\NetBeansProjects -Darchetype.interactive=false
-Dmaven.ext.class.path="C:\Program Files\NetBeans 8.2\java\maven-nblib\netbeans-eventspy.jar"
--batch-mode archetype:generate
I updated java ee plugings in netbeans, I added settings.xml
to C:\Users\Administrator\.m2
location which I copied from the maven package. I updated java ee plugings in netbeans, I added
settings.xml
to C:\Users\Administrator\.m2
location which I copied from the maven package.
But nothing seems to be working.但似乎没有任何效果。
Please help请帮忙
Update March 2020 - this should be fixed in NetBeans 11.2 and later, released on 25th October 2019. Details in the bug report . 2020 年 3 月更新- 这应该在 2019 年 10 月 25 日发布的 NetBeans 11.2 及更高版本中修复。 错误报告中的详细信息。
This is caused by a recent change in the JDK.这是由 JDK 的最近更改引起的。 Please see this question for more information.
请参阅此问题以获取更多信息。 Although the question relates to JDK11 the same change was made to JDK8 and the same solution (it is a work-around, really) applies.
尽管问题与 JDK11 有关,但对 JDK8 进行了相同的更改,并且相同的解决方案(实际上是一种变通方法)适用。
Edit your netbeans.conf
(you will find this in your netbeans directory under etc
) to add -J-Djdk.lang.Process.allowAmbiguousCommands=true
to the netbeans_default_options
key.编辑您的
netbeans.conf
(您将在etc
下的 netbeans 目录中找到此文件)以将-J-Djdk.lang.Process.allowAmbiguousCommands=true
添加到netbeans_default_options
键。 You can edit with notepad but you might need to do it as an Administrator depending on how you installed NB.您可以使用记事本进行编辑,但您可能需要以管理员身份进行编辑,具体取决于您安装 NB 的方式。
For example, mine looks like:例如,我的看起来像:
# JDK 11 made GTK 3 default on Linux. Unfortunately it makes
# NetBeans ugly on Linux with the default GTK+ Look and Feel,
# as a workaround -J-Djdk.gtk.version=2.2 has been added to the
# default command line arguments.
# (see: https://issues.apache.org/jira/browse/NETBEANS-1344)
#
netbeans_default_options="-J-Djdk.lang.Process.allowAmbiguousCommands=true -J-XX:+UseStringDeduplication -J-Xss2m -J-Djdk.gtk.version=2.2 -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.security=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.desktop/java.awt=ALL-UNNAMED -J--add-opens=java.desktop/java.awt.event=ALL-UNNAMED -J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED -J--add-opens=jdk.jshell/jdk.jshell=ALL-UNNAMED -J--add-modules=jdk.jshell -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED -J--add-exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J--add-exports=java.desktop/sun.swing=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED -J--add-exports=java.management/sun.management=ALL-UNNAMED -J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED -J--add-exports=jdk.javadoc/com.sun.tools.javadoc.main=ALL-UNNAMED -J-XX:+IgnoreUnrecognizedVMOptions"
Thanks to @Sephiroth for providing the answer.感谢@Sephiroth 提供答案。
Finally found the answer I downgraded my java version from jdk1.8.0_231
to jdk1.8.0_221
.终于找到了答案,我将我的 java 版本从
jdk1.8.0_231
降级到jdk1.8.0_221
。
Now everything is working fine.现在一切正常。 Hope this will help someone.
希望这会对某人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.