views:

32

answers:

2

When I try to install a custom jar with the following maven command then it will fail misirably:

mvn -X install:install-file -Dfile=D:\Work\...

Howerver the following does work:

mvn -X install:install-file -Dfile=\Work\...

You might now ask: So where is the problem? Well, I want to import from a script file and there I have the path with drive letter and all other trimmings.

So how would I go about this?

PS: The error message is:

[ERROR] No plugin found for prefix 'D' in the current project and in the> plugin groups [org.apache.maven.plugins, org.code haus.mojo] available from the repositories [local (D:\Repository), central (http://repo1.maven.org/maven2)] -> [Help 1] org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'D' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories

PPS: No spell checker in the companies bloody IE :-(

A: 

Could you try by using a valid Java path string ?

  • replacing '\' with '/'
  • or doubling each '\'
Alois Cochard
No problem on the command line. But rather difficult to archive in script file. Besides I also noticed a 2nd problem which is anwered here: http://stackoverflow.com/questions/442230/how-to-manually-install-an-artifact-in-maven-2 - check for the answere of S. Bollweber. I guess I need to refactor my scripts to use relativ path names.
Martin
Seen, but I just took a look at my own script and I noticed I do 'call mvn ...' instead of simply 'mvn ...' don't know if this help you (and I use only relative path)
Alois Cochard
Thanks for reminding me - of course I need to use CALL as well else the script will end after the first install (there is only one right now - but this will change).
Martin
A: 

In the end I opted for:

PUSHD %[PROJECT_HOME]
    CALL mvn    ^
     install:install-file  ^
     `-Dfile=lib/ojdbc14.jar` ^
     `-DgroupId=com.oracle`  ^
     `-DartifactId=ojdbc14`  ^
     `-Dversion=9.0.2.0.0`  ^
     `-Dpackaging=jar`
POPD

I used:

  • PUSHD so I can use relative path names .
  • CALL so the script won't prematurly end.
  • forward slashes instead of backslashes.
  • all -D parameters need to be backticked under Windows.

I hope that helps.

Martin