第三方的jar包,在不正式地场合可能会以jar本身的形式单独出现,没有依赖信息。如何将这种jar导入到我们本地的仓库呢?
mvn install:install-file -Dfile=D:commons-dbcp-1.3.jar -DgroupId=org.apache.commons -DartifactId=dbcp -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
之前也说过如何在eclipse中利用maven工程将其所打的包发布到nexus中,但如何将这种单独的jar文件上传呢?我们可以采用命令行的方式:
mvn deploy:deploy-file -DgroupId=org.apache.hadoop -DartifactId=hbase -Dversion=1.0 -Dpackaging=jar -Dfile=[path to file] -Durl=[url] -DrepositoryId=[id]
当然,这是需要权限的:
C:UsersBruceChanDesktop>mvn deploy:deploy-file -DgroupId=com.changhong.data -DartifactId=codis -Dversion=1.0 -Dpackaging=jar -Dfile=C:Users BruceChanDesktopcodis-1.0.0.jar -Durl=http://10.3.30.41:8089/nexus/content/groups/public/ -DrepositoryId=rcsRelases [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) @ standalone-pom --- Uploading: http://10.3.30.41:8089/nexus/content/groups/public/com/changhong/data/codis/1.0/codis-1.0.jar Uploading: http://10.3.30.41:8089/nexus/content/groups/public/com/changhong/data/codis/1.0/codis-1.0.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.376s [INFO] Finished at: Thu Aug 25 16:32:44 CST 2016 [INFO] Final Memory: 8M/244M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to de ploy artifacts: Could not transfer artifact com.changhong.data:codis:jar:1.0 from/to rcsRelases (http://10.3.30.41:8089/nexus/content/groups/publ ic/): Failed to transfer file: http://10.3.30.41:8089/nexus/content/groups/public/com/changhong/data/codis/1.0/codis-1.0.jar. Return code is: 400 , ReasonPhrase: Bad Request. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException