Nexus is a repository which is able to manage artifacts (jar files) for java, so that it can resolve its dependencies.
The user have to be authorized:
XML-Datei C:\Users[KUERZEL]\.m2\settings-security.xml anlegen mit folgendem Inhalt
<?xml version="1.0" encoding="WINDOWS-1250"?> <settingsSecurity> <master>MASTERPASSWORD_HERE</master> <!-- 123 --> </settingsSecurity>
Diese Datei nimmt das Master-Paßwort auf, das im nächsten Schritt erzeugt wird.
Eigenes Master-Paßwort wählen mvn –encrypt-master-password your_master_password Erzeugtes verschlüsseltes Master-Paßwort in settings-security einfügen. Die {} sind Teil des Paßworts. Benutzerpaßwort (IVU-Domänenpaßwort) ebenfalls verschlüsseln mvn –encrypt-password your_password Abschnitt <servers> in settings.xml suchen Es existieren darin zwei Tags <server>, einer für Snapshots und einer für Releases Username darin auf den IVU-Login-Benutzer setzen Password auf das gerade verschlüsselte IVU-Login-Paßwort setzen
mvn deploy:deploy-file -Dfile=android-4.1.2_r1.jar -DgroupId=android -DartifactId=android -Dversion=4.1.2_r1 -Dpackaging=jar -DrepositoryId=de.ivu.pto.p31.releases -Durl=http://ac-maven-build/nexus/content/repositories/releases/
mvn deploy:deploy-file -Dfile=android-4.1.2_r1.jar -DgroupId=android -DartifactId=android -Dversion=4.1.2_r1 -Dpackaging=jar -DrepositoryId=de.ivu.pto.p31.releases -Durl=http://ac-maven-build/nexus/content/repositories/releases/
The artifacts available for deployment can be found here:
Here are the details: https://books.sonatype.com/nexus-book/reference/install-additional-plugins.html
The structure of the nexus plugins looks as following:
[nexus-name-plugin-version] dependencies META-INF nexus-name-plugin-version.jar
To install plugins you have to unpack into the plugins into the folder [SONATYPE-WORK-FOLDER]/nexus/plugin-repository
Example of SONATYPE-WORK-FOLDER
/usr/share/tomcat7/sonatype-work/nexus/plugin-repository
P2 Update Sites may be hosted on Nexus, by installing the maven Unzip Plugin: it is hosted here
org.eclipse.tycho.nexus 0.14.0 | Maven2 repository |
org.sonatype.nexus 1-3 | Maven2 repository |
The details about installation and configuration of the Nexus Unzip Plugin are here: https://wiki.eclipse.org/Tycho/Nexus_Unzip_Plugin
Details here: https://support.sonatype.com/entries/23674267-How-can-I-retrieve-a-snapshot-if-I-don-t-know-the-exact-filename-
wget "http://repository.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.sonatype.nexus&a=nexus-utils&v=LATEST" --content-disposition
r = the id of the repository or group to search (Required) g = the groupId of the file (Required) a = the artifactId of the file (Required) v = the version of the file, this may be "LATEST", "RELEASE", a version number like "2.0", or a snapshot version number like "2.0-SNAPSHOT". (Required) c = the classifier of the file (Optional) e = the type or extension of the file (Optional) p = packaging (Nexus will resolve known packaging types to the correct extension). (Optional)
Workin on a raw repository “rawtest”
# upload curl.exe --fail -u admin:admin123 --upload-file ./Hello_Iam_an_artifact.txt.zip http://localhost:32553/repository/rawtest/ # delete via curl on Nexus # DELETING FOLDERS DONT WORK IN NEXUS3 curl -v --user admin:admin123 -X DELETE --write %{http_code} %{url_effective}\n --output /dev/null --silent http://nexus.otm.intra:32553/repository/rawtest/com/csg/cs/corex/lib/userpreferences-lib/7.3.0/userpreferences-lib-7.3.0-dirlist.txt curl -v --user admin:admin123 -X DELETE --write %{http_code} %{url_effective}\n --output /dev/null --silent http://nexus.otm.intra:32553/repository/rawtest/com/csg/cs/corex/lib/userpreferences-lib/7.3.0/userpreferences-lib-7.3.0-javadoc.jar curl -v --user admin:admin123 -X DELETE --write %{http_code} %{url_effective}\n --output /dev/null --silent http://nexus.otm.intra:32553/repository/rawtest/com/csg/cs/corex/lib/userpreferences-lib/7.3.0/userpreferences-lib-7.3.0-javadoc.jar.sha1 curl -v --user admin:admin123 -X DELETE --write %{http_code} %{url_effective}\n --output /dev/null --silent http://nexus.otm.intra:32553/repository/rawtest/com/csg/cs/corex/lib/userpreferences-lib/7.3.0/userpreferences-lib-7.3.0-sources.jar
Workin on a maven-type repository
curl -v -F "r=otmartifacts" -F "hasPom=false" -F "e=zip" -F "g=myapplication" -F "a=mytest" -F "v=6.2" -F "p=zip" -F "c=-2017-01-01" -F "file=@myFIleToUpload.txt" -u "USERNAMEX:mYpAssWord" http://nexus2x-efs.otm.intra:8081/nexus/service/local/artifact/maven/content
To repos
mvn deploy:deploy-file -DgroupId=com.dom -DartifactId=tom -Dversion=1.0.0 -DgeneratePom=false -Dpackaging=zip -DrepositoryId=artifacts-releases -Durl=http://localhost:32331/repository/artifacts-releases/ -Dfile=testartifact.zip mvn deploy:deploy-file -DgroupId=com.dom -DartifactId=tom -Dversion=1.0.0-SNAPSHOT -DgeneratePom=false -Dpackaging=zip -DrepositoryId=artifacts-snapshots -Durl=http://localhost:32331/repository/artifacts-snapshots/ -Dfile=testartifact.zip
function GetFiles($path = $pwd, [string[]]$exclude) { foreach ($item in Get-ChildItem $path) { if ($exclude | Where {$item -like $_}) { continue } if (Test-Path $item.FullName -PathType Container) { $item GetFiles $item.FullName $exclude } else { if ($item.extension -eq ".jar") { $assoc = New-Object psobject -Property @{ Pom = "$($item.DirectoryName)\$($item.BaseName).pom" Jar = "$($item.DirectoryName)\$($item.BaseName).jar" } Write-Host "$($assoc.Pom) $($assoc.Jar)" & "C:\Users\csuser4\Downloads\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin\mvn.cmd" deploy:deploy-file "-DrepositoryId=otm-gfm-repository" "-Durl=http://localhost:32553/repository/otm-gfm-repository/" "-DpomFile=$($assoc.Pom)" "-Dfile=$($assoc.Jar)" } } } } # $env:JAVA_HOME="C:\Program Files\Java\jdk1.8.0_102\" # $env:Path += ";C:\Program Files\Java\jdk1.8.0_102\bin" GetFiles("C:\data\cgf\repositoryTarget")