簡體   English   中英

將jar部署到maven內部存儲庫

[英]Deploy jar to the maven internal repository

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

mvn -X deploy:deploy-file -Durl = scp:// localhost / my-repo / -DrepositoryId = localhost -Dfile = temp.jar -DgroupId = com.myorg -DartifactId = temp -Dversion = 1.0 -Dpackaging = jar - Dclassifier = test -DgeneratePom = true -DgeneratePom.description =“temp test”-DrepositoryLayout = default -DuniqueVersion = false

我使用的是Windows XP和apache-maven-3.0.3。 我收到以下錯誤 -

“[錯誤]無法在項目standalone-pom上執行目標org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file(default-cli):無法部署工件/元數據:沒有可用於訪問的連接器使用可用工廠WagonRepositoryConnectorFactory的default localhost(scp:// localhost / commons-logging /)類型為default

我從來沒有在Windows上使用過scp,因為我在linux機器上工作過,我也不需要安裝它來實現這個任務,然后我可以從哪里安裝它以及如何克服我所面臨的錯誤。 請指導我這個問題。

謝謝!!

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目錄,並為網絡用戶設置適當的權限,並在塞拉先生的博客上填寫,他已經為我的案例提供了近乎工作的指示

你沒有提到這個存儲庫是什么。 如果相關存儲庫是您的本地計算機存儲庫,則可以執行以下操作:

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。

我有同樣的問題,通過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和版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM