문제

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

도움이 되었습니까?

해결책

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.

다른 팁

I got a very similar error except my was prefix 'C'...

After reading this thread, I added single quotation mark to my jar file name as -Dfile=‘C:\work\perforce\trunk\Lib\ftp4j\ftp4j-1.7.2.jar’ and you need to make sure there is no space between the = and the '.

Adding the single quotes fixed it and I was able to have "BUILD SUCCESS" as my output after the install.

But guess what I see in my repository folder? The ftp4j-1.7.2.jar.lastUpdated, ftp4j-1.7.2.pom, ftp4j-1.7.2.pom.lastUpdated files were all created in the folder by the installation, but the actual ftp4j-1.7.2.jar was NOT/failed to copy over...So at this point, I just manually copy the ftp4j-1.7.2.jar over myself to the repository and that seems to finally work.

I had this problem using PowerShell, but somehow, it was resolved when I used Command Prompt...

Could you try by using a valid Java path string ?

  • replacing '\' with '/'
  • or doubling each '\'

Example for ojdbc6.jar install (on Windows).

Download ojdbc drivers from Oracle. Next in "Command Shell" issue command

mvn install:install-file -Dfile="C:\Users\yourusername\Downloads\ojdbc6-11.2.0.3.jar" -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top