0

我无法让Netbeans 7.3.1在我指定的目录中创建Maven Web 应用程序。

操作系统:Windows 7 x64
NetBeans:7.3.1
Maven:3.0.4/3.0.5

我正在使用NetBeans GUI及其内部Maven 3.0.5来创建这种类型的项目。无论我指定哪个文件夹,它总是在我的E: \ 驱动器的根目录中创建项目。

这是一个示例:在提供了创建项目所需的所有参数后单击“完成”按钮后:

>     cd E:\Dev\Java\Test; JAVA_HOME=E:\\Apps\\Dev\\jdk6u23 "M2_HOME=E:\\Apps (x86)\\Dev\\apachemaven\\apache-maven-3.0.4"
> "\"E:\\Apps
> (x86)\\Dev\\apachemaven\\apache-maven-3.0.4\\bin\\mvn.bat\""
> -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=be.kdg -DartifactId=mavenproject22 -Dversion=1.0-SNAPSHOT -Dpackage=be.kdg.mavenproject22 -Dbasedir=E:\\Dev\\Java\\Test -Darchetype.interactive=false --batch-mode archetype:generate Scanning for projects...
>                                                                         
> ------------------------------------------------------------------------ Building Maven Stub Project (No POM) 1
> ------------------------------------------------------------------------
> 
> >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
> 
> <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom
> <<<
> 
> [archetype:generate] Generating project in Batch mode Archetype
> defined by properties
> ---------------------------------------------------------------------------- Using following parameters for creating project from Archetype:
> webapp-javaee6:1.5
> ---------------------------------------------------------------------------- 
Parameter: groupId, Value: be.kdg 
Parameter: artifactId, Value: mavenproject22
Parameter: version, Value: 1.0-SNAPSHOT 
Parameter: package, Value: be.kdg.mavenproject22
Parameter: packageInPathFormat, Value: be/kdg/mavenproject22
Parameter: package, Value: be.kdg.mavenproject22
Parameter: version, Value: 1.0-SNAPSHOT
Parameter: groupId, Value: be.kdg 
Parameter: artifactId, Value: mavenproject22

project created from Archetype in dir: E:\mavenproject22
> ------------------------------------------------------------------------ 
BUILD SUCCESS
> ------------------------------------------------------------------------ 
Total time: 1.643s Finished at: Sat Sep 21 20:01:57 CEST 2013 Final
> Memory: 8M/120M
> ------------------------------------------------------------------------

这是我第 22 次尝试在指定目录中创建Maven Web 应用程序项目。NetBeans 或 Maven 就是不听,我不知道为什么会这样。

如果 basedir 是E:\Dev\Java\Test,那么为什么它会在E: \root 中创建我的项目?

4

3 回答 3

2

我遇到了同样的问题,我试过这个:“检查注册表 HKEY_CURRENT_USER\Software\Microsoft\Command Processor,看看你是否在那里设置了 Autorun 键。我删除了我的并让它工作。” 但我没有自动运行选项。这个plz的任何其他解决方案!.

于 2013-11-02T12:30:03.630 回答
0

在 7.3.1 中也适用于我

cd D:\Program Files (x86); "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_25" "\"D:\\Program Files\\NetBeans 7.3.1\\java\\maven\\bin\\mvn.bat\"" -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=com.mycompany -DartifactId=mavenproject25 -Dversion=1.0-SNAPSHOT -Dpackage=com.mycompany.mavenproject25 "-Dbasedir=D:\\Program Files (x86)" -Darchetype.interactive=false --batch-mode archetype:generate
Scanning for projects...

------------------------------------------------------------------------
Building Maven Stub Project (No POM) 1
------------------------------------------------------------------------

>>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>

<<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<

[archetype:generate]
Generating project in Batch mode
Archetype defined by properties
----------------------------------------------------------------------------
Using following parameters for creating project from Archetype: webapp-javaee6:1.5
----------------------------------------------------------------------------
Parameter: groupId, Value: com.mycompany
Parameter: artifactId, Value: mavenproject25
Parameter: version, Value: 1.0-SNAPSHOT
Parameter: package, Value: com.mycompany.mavenproject25
Parameter: packageInPathFormat, Value: com/mycompany/mavenproject25
Parameter: package, Value: com.mycompany.mavenproject25
Parameter: version, Value: 1.0-SNAPSHOT
Parameter: groupId, Value: com.mycompany
Parameter: artifactId, Value: mavenproject25
project created from Archetype in dir: D:\Program Files (x86)\mavenproject25
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.603s
Finished at: Thu Sep 26 23:57:13 CEST 2013
Final Memory: 13M/304M
------------------------------------------------------------------------
于 2013-09-26T22:00:33.157 回答
0

为我工作..

Product Version: NetBeans IDE 7.4 RC1 (Build 201309162201)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

输出

cd D:\temp\NetBeansProjects; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_25" cmd /c "\"\"D:\\tools\\NetBeans7.4 RC1\\java\\maven\\bin\\mvn.bat\" -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=sample.webapp -DartifactId=mavenproject24 -Dversion=1.1.0-SNAPSHOT -Dpackage=sample.webapp.mavenproject24 -Dbasedir=D:\\temp\\NetBeansProjects -Darchetype.interactive=false -Dmaven.ext.class.path=\"D:\\tools\\NetBeans7.4 RC1\\java\\maven-nblib\\netbeans-eventspy.jar\" --batch-mode archetype:generate\"\""
Scanning for projects...

------------------------------------------------------------------------
Building Maven Stub Project (No POM) 1
------------------------------------------------------------------------

>>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>

<<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<

--- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
Generating project in Batch mode
Archetype defined by properties
----------------------------------------------------------------------------
Using following parameters for creating project from Archetype: webapp-javaee6:1.5
----------------------------------------------------------------------------
Parameter: groupId, Value: sample.webapp
Parameter: artifactId, Value: mavenproject24
Parameter: version, Value: 1.1.0-SNAPSHOT
Parameter: package, Value: sample.webapp.mavenproject24
Parameter: packageInPathFormat, Value: sample/webapp/mavenproject24
Parameter: package, Value: sample.webapp.mavenproject24
Parameter: version, Value: 1.1.0-SNAPSHOT
Parameter: groupId, Value: sample.webapp
Parameter: artifactId, Value: mavenproject24
project created from Archetype in dir: D:\temp\NetBeansProjects\mavenproject24
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 0.943s
Finished at: Sun Sep 22 17:41:23 CEST 2013
Final Memory: 9M/241M
------------------------------------------------------------------------
于 2013-09-22T15:44:46.010 回答