Netbeans 7.x:Maven在错误的目录中创建我的项目

时间:2013-09-21 18:27:06

标签: java maven netbeans directory install

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

OS: Windows 7 x64
NetBeans: 7.3.1
Maven: 3.0.4/3.0.5

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

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

>     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中创建我的项目?

3 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分: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
------------------------------------------------------------------------

答案 2 :(得分: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
------------------------------------------------------------------------