2011-11-09 119 views
3

我創建了maven內部存儲庫。我有沒有使用maven創建的jar,即沒有pom.xml文件。我需要將這個jar部署到我創建的內部存儲庫。爲此我使用了mvn deploy:deploy-file。 以下是我所用過的命令 -將jar部署到maven內部存儲庫

MVN -X部署:部署文件-Durl = SCP://本地主機/我的回購/ -DrepositoryId =本地主機-Dfile = temp.jar -DgroupId = COM .myorg -DartifactId =溫度-Dversion = 1.0 -Dpackaging =罐子-Dclassifier =測試-DgeneratePom =真-DgeneratePom.description = 「溫度測試」 -DrepositoryLayout =默認-DuniqueVersion =假

我使用Windows XP和Apache的行家-3.0.3。我遇到以下錯誤 -

「[錯誤]未能執行目標項目standalone-pom上的org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file(default-cli):Failed部署工件/元數據:沒有連接器可用來訪問使用可用工廠WagonRepositoryConnectorFactory類型的存儲庫本地主機(scp:// localhost/commons-logging /)「

我從來沒有在Windows上使用過scp在Linux機器上,我也不需要安裝它來實現這個任務,那麼我可以從哪裏安裝它,以及如何克服我面臨的錯誤。請指導我解決這個問題。

謝謝!

+0

錯誤已解決,我們只需將jar複製到maven_install_dir/lib/ext /中即可。以下是jar文件 1. jsch-0.1.38.jar 2.叢的交互的API-1.0-α-6 3.車皮-SSH-1.0-β-7 4.車皮SSH-共同-1.0-β-7 我們需要爲我們嘗試部署未使用的Maven創建了一個罈子要做到這一點,因爲和它沒有一個pom.xml,所以我們不能添加 ...需要執行wagon-ssh。因此,我們直接將它們添加到mvn/lib/ext /中。 –

回答

1

你不提這個存儲庫是什麼。如果有問題的存儲庫是本地計算機存儲庫,你可以這樣做:

mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dpackaging=jar -Dversion=1.0.1B -Dfile=jta-1.0.1B.jar -DgeneratePom=true 

如果該存儲庫類似的Nexus,然後用自己的UI上傳的神器,它會創建一個POM你。

0

我有同樣的問題,通過ssh部署一個專有的第三方jar到我們的內部倉庫。我結束了使用一個小的Ant腳本,我覺得它比擺弄Maven類路徑更安全。

<?xml version="1.0"?> 
<project name="Maven Deploy" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> 

    <property name="repository.id" value="myrepository"/> 
    <property name="repository.url" value="sftp://dev.example.com/var/www/mvn"/> 

    <target name="init"> 
    <mkdir dir="target/lib"/> 
    <get src="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar" dest="target/lib" skipexisting="true"/> 
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpath="target/lib/maven-ant-tasks-2.1.3.jar"/> 

    <artifact:install-provider artifactId="wagon-ssh" version="2.2"/> 
    </target> 

    <target name="deploy" depends="init"> 

    <echo>Deploy a jar to the Maven repository:</echo> 
    <input addproperty="groupId" message="groupId:"/> 
    <input addproperty="artifactId" message="artifactId:"/> 
    <input addproperty="version" message="version:"/> 
    <input addproperty="file"  message="file:" defaultvalue="${artifactId}-${version}.jar"/> 

    <artifact:mvn failonerror="true"> 
     <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file"/> 
     <arg value="-DgroupId=${groupId}"/> 
     <arg value="-DartifactId=${artifactId}"/> 
     <arg value="-Dversion=${version}"/> 
     <arg value="-Durl=${repository.url}"/> 
     <arg value="-DrepositoryId=${repository.id}"/> 
     <arg value="-Dfile=${file}"/> 
    </artifact:mvn> 

    </target> 

</project> 

只需鍵入ant deploy,並指定文件的groupId,artifactId和version。

1

mvn deploy:deploy-file -Durl=scp://d8u.us/home/hd1/public_html/maven2 -DrepositoryId=localhost -Dfile=yourwar.jar -DgroupId=us.d8u -DartifactId=yourwar -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true -DrepositoryLayout=default -DuniqueVersion=false適合我。我只需要在我的主目錄下創建maven2目錄,併爲該網絡用戶設置相應的權限,並將Mr. Sierra的博客關閉,他在那裏友好地提供了接近工作的instructions for my case

相關問題