Use windows drive letters in maven install:install-file

Martin picture Martin · Oct 13, 2010 · Viewed 7.4k times · Source

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 :-(

Answer

Martin picture Martin · Oct 15, 2010

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.