Generally if you are using Powershell for Maven, svn etc you end up
having to escape any arguments which start with a dash (-).  The escape
character in Powershell is a backtick.  So you end up with mvn
archetype:create `-DgroupId=blah `-DartifactId=blah.  There's probably
an easier way but that works for me.  I seem to remember posting on this
list about this when Powershell first came out (1.0) and I now think it
is more of a general Powershell thing than anything to do with Maven,
especially as I get the same thing with Subversion.  I've scripted most
of our build with Powershell on top of Maven, so it certainly works with
2.0.9 if you add in the escaping.

Martin.


----- Original message -----
From: "Marc Weidner" <[EMAIL PROTECTED]>
To: "Maven Users List" <users@maven.apache.org>
Date: Fri, 18 Apr 2008 15:13:13 +0200
Subject: Re: Maven Microsoft Windows PowerShell

Hi James,

I never tried PowerShell before. Just thought that it will work out of 
the box.

The suggestion with the quotes (also mentioned by Raphaël Piéroni) just 
worked fine:

mvn.bat archetype:create "-DgroupId=com.mycompany.app"
-DartifactId=my-app

I think there are also other issues regarding Maven, PowerShell and 
quoting. I will make some tests and report further results here.

Regards

Marc Weidner


James William Dumay schrieb:
> Marc,
> It might be worth opening a JIRA for this one - I don't think PowerShell 
> is supported.
> 
> Had this been working correctly for you before hand? Does quoting the 
> arguments help?
> 
> James
> 
> On 18/04/2008, at 8:02 PM, Marc Weidner wrote:
> 
>> Hi,
>>
>> I'm having issues regarding using Maven 2.0.9 with Microsoft Windows 
>> PowerShell 1.0 and JDK 1.6.0_05.
>>
>> I start PowerShell and set the JAVA_HOME environment variable via 
>> $env:JAVA_HOME = "path-to-jdk".
>>
>> When I issue the command mvn -version I get the version information 
>> displayed. Then I want to create the sample project via the following 
>> command:
>>
>> C:\Programme\apache-maven-2.0.9\bin\mvn.bat archetype:create 
>> -DgroupId=com.mycompany.app -DartifactId=my-app
>>
>> I get the following error message:
>>
>> [INFO] Scanning for projects...
>> [INFO] Searching repository for plugin with prefix: 'archetype'.
>> [INFO] 
>> ------------------------------------------------------------------------
>> [ERROR] BUILD FAILURE
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Invalid task '.mycompany.app': you must specify a valid 
>> lifecycle phase, or a goal in the format plugin:goal or 
>> pluginGroupId:pluginArtifactId:pluginVersion:goal
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] For more information, run Maven with the -e switch
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Total time: < 1 second
>> [INFO] Finished at: Fri Apr 18 11:57:00 CEST 2008
>> [INFO] Final Memory: 2M/4M
>> [INFO] 
>> ------------------------------------------------------------------------
>>
>> If I run the command via the good old cmd.exe all works fine. Can 
>> someone confirm this behavior?
>>
>> Regards
>>
>> Marc Weidner
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> Marc,
> It might be worth opening a JIRA for this one - I don't think PowerShell 
> is supported.
> 
> Had this been working correctly for you before hand? Does quoting the 
> arguments help?
> 
> James
> 
> On 18/04/2008, at 8:02 PM, Marc Weidner wrote:
> 
>> Hi,
>>
>> I'm having issues regarding using Maven 2.0.9 with Microsoft Windows 
>> PowerShell 1.0 and JDK 1.6.0_05.
>>
>> I start PowerShell and set the JAVA_HOME environment variable via 
>> $env:JAVA_HOME = "path-to-jdk".
>>
>> When I issue the command mvn -version I get the version information 
>> displayed. Then I want to create the sample project via the following 
>> command:
>>
>> C:\Programme\apache-maven-2.0.9\bin\mvn.bat archetype:create 
>> -DgroupId=com.mycompany.app -DartifactId=my-app
>>
>> I get the following error message:
>>
>> [INFO] Scanning for projects...
>> [INFO] Searching repository for plugin with prefix: 'archetype'.
>> [INFO] 
>> ------------------------------------------------------------------------
>> [ERROR] BUILD FAILURE
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Invalid task '.mycompany.app': you must specify a valid 
>> lifecycle phase, or a goal in the format plugin:goal or 
>> pluginGroupId:pluginArtifactId:pluginVersion:goal
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] For more information, run Maven with the -e switch
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Total time: < 1 second
>> [INFO] Finished at: Fri Apr 18 11:57:00 CEST 2008
>> [INFO] Final Memory: 2M/4M
>> [INFO] 
>> ------------------------------------------------------------------------
>>
>> If I run the command via the good old cmd.exe all works fine. Can 
>> someone confirm this behavior?
>>
>> Regards
>>
>> Marc Weidner
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to