Install obr plugin in Nexus - osgi

I would like to install the Nexus-obr-plugin GitHub in my Nexus oss 2.10.0-02.
The OBR-plugin seems not to be shipped in the Standard Nexus OSS. I could find the jar Version of this plugin http://mvnrepository.com/artifact/org.sonatype.nexus.plugins/nexus-obr-plugin/2.10.0-02.
I looked at the other Plugins shipped with Nexus, every plugin seems to be in a folder containing the jar,Manifestfile (under META-INF) and required dependencies.
I placed the jar in the folder plugin-repository/nexus-obr-plugin-2.10.0-02/nexus-obr-plugin-2.10.0-02.jar. Downloaded required dependecies in the dependencies folder:
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.service.obr</artifactId>
</dependency>
and created a MANIFEST File, based on other MANIFEST Files from other Nexus Plugins. With this I managed to start Nexus without Errors and the Plugin Console states that the OBR-Plugin is Activated. But there is no OBR Provider available under 'Create new Hosted repository'.
Is there a good explanation how to install the obr plugin and where can the plugin with all dependencies and MANIFEST File be downloaded?

You need to install the bundle folder rather than just the jar file. These can be downloaded in zip format from the sonatype repository:
https://repository.sonatype.org
For the 2.10.0-02 OBR bundle you'll find it here:
https://repository.sonatype.org/service/local/repo_groups/forge/content/org/sonatype/nexus/plugins/nexus-obr-plugin/2.10.0-02/nexus-obr-plugin-2.10.0-02-bundle.zip
unzip that to the plugin-repository folder and restart nexus.

Related

Nexus doesn't download the complete artifact content from the Central repository

In our project we use the artifact
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>1.7.5</version>
</dependency>
Everything works fine: Nexus downloads the same content as in http://repo1.maven.org/maven2/nl/jqno/equalsverifier/equalsverifier/1.7.5/ to its proxy repository.
('Download' column in artifact details on Nexus shows 'pom, jar')
Now, we switch to the newest version 2.0.2 of the artifact:
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>2.0.2</version>
</dependency>
Then, when we try to build the project then the attempt fails. Nexus cannot resolve the artifact! It seems like Nexus didn't download the complete content of the artifact version ('Download' column in artifact details on Nexus shows 'pom, pom'). On the other site, when I look at the artifact in the Central repository, the content is as usual: http://repo1.maven.org/maven2/nl/jqno/equalsverifier/equalsverifier/2.0.2/.
What causes the problem with the newest artifact version? Why can't Nexus download it correctly?
You may have overlooked that your dependency is of type pom. This will only download the pom, because that's what you are asking for. Remove the <type> and you should get the jar aswell.
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>2.0.2</version>
<type>pom</type> <-------------- Remove this
</dependency>
Assuming crea1's answer didn't solve your problem:
Maybe something went wrong when Maven downloaded the artifact, causing Maven to "think" the artifact was downloaded anyway.
You can force Maven to try and download it again with mvn -U test.
If that doesn't work, try going into ~/.m2/repository (or wherever Maven stores its artifacts locally on your system), locating EqualsVerifier, removing the entire 2.0.2 folder, and calling Maven again.

How to download in an zip archive a maven artifact (pom and jar) and all its dependencies (poms and jars too) using only a web browser?

I have installed an Nexus repository which is completely offline (no link to internet). Sometimes, I need to add others maven artifacts and I have only a web browser to download them, artifact by artifact, for example from http://mvnrepository.com. It is tedious... And I have no way to install a Maven client on the session running this web browser.
I am searching an online service allowing to define only the artifact to download and to get an zip file including the specified artifact and all its dependencies (POMs and jars).
http://jar-download.com/online-maven-download-tool.php is doing something like this. The user specify a dependency, eg
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
and the site generates a POM, executes the maven-dependency-plugin:copy-dependencies goal against the generated POM, and allow to download a zip file.
But this zip file does not include the POMs, only the jars, even if pom is added to the dependency tag.
I will ask the owner of this site if he can activate the copyPom parameter but maybe another online service is already doing this.
Thanks for your help.

Can I download a jar file from maven central using maven?

I have a dependency problem with maven. I used to have saxon 8.7 that is located on maven central. Then, I had to upgrade to the latests saxon-b 9.1.0.0 which is only partially on maven central.
This is a snippet of my dependencies:
<dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxon</artifactId>
<version>9.1.0.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxon-dom</artifactId>
<version>9.1.0.8</version>
<scope>runtime</scope>
</dependency>
The first artifact 'saxon' is available on maven central, but the secon 'saxon-dom'. Here is the artifact I want.
Can I tell maven to download the "jar" file or am I obliged to download the jar and publish it locally on my maven repo to use it as a dependency?
Did not expect to resolve this so easily :
<dependency>
<groupId>net.sourceforge.saxon</groupId>
<artifactId>saxon</artifactId>
<version>9.1.0.8</version>
<classifier>dom</classifier>
</dependency>
Basically, I can get the dependencies that are "attached" to the 'saxon' artifact using the classifier tag. Did not know about this and I found out that the tag existed when I searched for 'saxon' on Sonatype repository (which is quite good). It gave me the dependency snippet above.
Reference : http://maven.apache.org/pom.html
If the required version is not in the repo, then yes you need to do one of the following alternatives
Search for a public repo containing the required version of jar. And add the repo to your pom.xml file. OR
Download it manually, and install it locally on your machine, to help the project build completely.

Maven - Unable to resolve dependencies

Im trying to compile a Maven project. The compile fails however due to a "Failure to find xx.xxx.jar" in the repository i have specified in my settings.xml. I have access to this repository and when i navigate to the Url of the repository maven is trying to use i can see a pom file with the name of the jar but no jar. When i open the pom it contains the correct groupid and artificatid and jar name however the jar is not in the same directory.
Maven gives another error saying that "resolution will not be reattempted until the update interval of my repo-server has elasped or updated are forced".
What is happening here?
When maven goes to the repo i specify in settings.xml and finds a pom for the jar does it then try and go out to some external site to resolve the dependency or should the jar exist in the same folder as the pom?
What module are you attempting to download?
I discovered something similar with the following Maven central module:
http://search.maven.org/#artifactdetails|net.sf.json-lib|json-lib|2.4|jar
The Maven POM packaging declaration was jar, but no jar in Maven called "json-lib-2.4.jar"
When I looked at the files actually stored, I discovered that the author is providing two versions of the jar, each compiled for different versions of the JVM:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk13</classifier>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>

Best way to create maven project to upload missing jars in central repository

ProGuard version 4.5, 4.5.1 and 4.6 have been released, but unfortunately, the corresponding maven artifacts have not been released in central repository:
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>4.4</version> <-- This is the limit
<scope>runtime</scope> </dependency>
I have left a message on Proguard's forum for more information. I am considering releasing them myself since Eric Lafortune mentioned he is not involved with maven anymore.
Instead of recompiling the code, I was wondering whether it might be possible to create a maven project to install existing jars (available from sourceforge) into the central repository. This is different than installing external jars in a local repository.
How can I configure my pom.xml to achieve this assuming those jars are available in my local repository? Is this possible?
The next step would be to use Sonatype's repository as a stepstone to release the artifacts into central repository.

Resources