0
Manuelles Upload eines Jars ins Artefactory
Um ein einzelnes Jar in ein Artefactory hoch zu laden, ist ein angepasstes Kommando in der nachfolgenden Art auf der Konsole auszuführen:
mvn deploy:deploy-file -DrepositoryId=<ID-OF-SERVER> -Durl=http://<HOST>:<PORT>/artifactory/libs-releases-local -DgroupId=<GROUPID> -DartifactId=<ARTIFACT-ID> -Dversion=<VERSION> -Dpackaging=jar -Dfile=<LOCAL-PATH> -DgeneratePom=true
Beispiel:
mvn deploy:deploy-file -DrepositoryId=myrepro -Durl=http://artifactory:8081/artifactory/libs-releases-local -DgroupId=net.sourceforge -DartifactId=schemaspy -Dversion=3.1.1 -Dpackaging=jar -Dfile=D:\data\os-projects\schemaSpy_thin\schemaSpy_3.1.1.jar -DgeneratePom=true
Wichtig:
Die repositoryId muss in der settings.xml (z.B. C:\Dokumente und Einstellungen\analysisfreaks\.m2\settings.xml) konfiguriert sein.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <!-- . . . --> <!-- servers | This is a list of authentication profiles, keyed by the server-id used within the system. | Authentication profiles can be used whenever maven must make a connection to a remote server. |--> <servers> <!-- server | Specifies the authentication information to use when connecting to a particular server, identified by | a unique name within the system (referred to by the 'id' attribute below). | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | <server> <id>deploymentRepo</id> <username>repouser</username> <password>repopwd</password> </server> --> <!-- Another sample, using keys to authenticate. <server> <id>siteServer</id> <privateKey>/path/to/private/key</privateKey> <passphrase>optional; leave empty if not used.</passphrase> </server> --> <server> <id>myrepro</id> <username>admin</username> <password>password</password> </server> </servers> <!-- . . . --> </settings>
Eine erfolgreiches Upload sieht so aus:
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'deploy'. [INFO] ----------------------------------------------------------------------- [INFO] Building Maven Default Project [INFO] task-segment: [deploy:deploy-file] (aggregator-style) [INFO] ----------------------------------------------------------------------- [INFO] [deploy:deploy-file {execution: default-cli}] Uploading: http://artifactory:8081/artifactory/libs-releases-local/net/sourceforge/schemaspy/3.1.1/schemaspy-3.1.1.jar 146K uploaded (schemaspy-3.1.1.jar) [INFO] Retrieving previous metadata from myrepro [INFO] repository metadata for: 'artifact net.sourceforge:schemaspy' could not be found on repository: myrepro. dom, so will be created [INFO] Uploading repository metadata for: 'artifact net.sourceforge:schemaspy' [INFO] Uploading project information for schemaspy 3.1.1 [INFO] ----------------------------------------------------------------------- [INFO] BUILD SUCCESSFUL [INFO] ----------------------------------------------------------------------- [INFO] Total time: 2 seconds [INFO] Finished at: Wed May 04 09:10:50 CEST 2011 [INFO] Final Memory: 4M/8M [INFO] -----------------------------------------------------------------------