Reputation: 1574
I have created a maven internal repository. I am having jars that were not created using maven i.e. there is not pom.xml file for them. I need to deploy this jar to the internal repository that I have created. For this purpose i used mvn deploy:deploy-file. Following is the command that i have used -
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
I am using windows xp and apache-maven-3.0.3. I am getting following error -
"[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts/metadata: No connector available to access repository localhost (scp://localhost/commons-logging/) of type default using the available factories WagonRepositoryConnectorFactory"
I have never used scp on windows as I have worked on linux machines and I also dont do i need to install it for achieving this task then where can i install it from and how to overcome the error that I am facing. Please guide me regarding this issue.
Thanks!!
Upvotes: 3
Views: 4174
Reputation: 10988
I had the same issue to deploy a proprietary third party jar into our internal repository over ssh. I ended using a small Ant script, I felt it was safer than fiddling with the Maven classpath.
<?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>
Just type ant deploy
and specify the groupId, artifactId and version of your file.
Upvotes: 0
Reputation: 34657
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
works for me. I merely needed to create the maven2
directory under my home directory and set the appropriate permissions for the web user and cribbed off Mr. Sierra's blog, where he has kindly provided near-working instructions for my case.
Upvotes: 1
Reputation: 21924
You don't mention what this repository is. If the repository in question is your local machine repository you can do this:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dpackaging=jar -Dversion=1.0.1B -Dfile=jta-1.0.1B.jar -DgeneratePom=true
If the repository is something like Nexus, then use their UI to upload the artifact and it will create a pom for you.
Upvotes: 1